saving an exception
Bryan
belred at gmail.com
Tue Oct 3 01:15:15 EDT 2006
hi,
i would like to save an exception and reraise it at a later time.
something similar to this:
exception = None
def foo():
try:
1/0
except Exception, e:
exception = e
if exception: raise exception
i have a need to do this because in my example foo is a callback from c code
which was originally called from python and i can't modify the c code.
with the above code, i'm able to successfully raise the exception, but the
line number of the exception is at the place of the explicit raise instead
of the where the exception originally occurred. is there anyway to fix
this?
thanks,
bryan
More information about the Python-list
mailing list