On Mar 23, 9:29 am, Thomas Dybdahl Ahle <[EMAIL PROTECTED]> wrote: > Hi, I have a function, which looks like the following: > > connecting = False > def func (): > global connecting > connecting = True > try: > # Do lot of network stuff > except Exception, e: > connecting = False > raise e > > This works quite good, but it is a hell to debug. Instead of getting a > log message to the line which originally raised the exception. > > Is there anyway to reraise an exception, but preserve the log?
You could import traceback and use its functionality. Lundh mentioned using sys.exc_info about an hour ago to another user. See http://effbot.org/pyref/sys.exc_info.htm Mike -- http://mail.python.org/mailman/listinfo/python-list