[Tutor] clearing traceback after exeption is handled
pythonTutor at venix.com
Tue May 25 15:18:03 EDT 2004
When possible, I have my Python programs send an email when there is a
failure or problem during execution. The email routine ALWAYS calls
Today I got an email with a "stale" traceback from an exception that had
been handled along with information about the real problem. I started
researching the traceback before I realized it was not relevant.
It took me a while to find out how to clear an exception after handling
it, so I thought it was worth posting the information.
In Python 2.3, the sys module now has a function
that will clear all information relating to the last or current
exception for the current thread. It is mostly of use to prevent
logging and reporting of exceptions that have already been handled.
1 Court Street, Suite 378
Lebanon, NH 03766-1358
More information about the Tutor