propapating exceptions

Andreas Jung ajung at sz-sb.de
Sat Jul 17 11:26:28 EDT 1999


On Fri, Jul 16, 1999 at 08:43:33PM -0500, Thomas Bryan wrote:
> 
> I can't find the reference now, but I think that I read in 
> the Python docs that calling raise without an argument inside 
> an except, reraises the error.
> 
> That is, 
> 
> try:
>         some sql command
> except ODBC.MySQL.OperationalError, msg:
>         if msg[1] == CR_SERVER_GONE_ERROR: # (snarfed out of errmsg.h)
>                 restart server, try again
>         else:
>                 raise
> 
> Does that work?

This should work - raise without any arguments should reraise
the same exception without modifying the traceback - that's at
least the way it works on my system.

Cheers,
Andreas




More information about the Python-list mailing list