Castrated traceback in sys.exc_info()

Andreas Löscher andreas.loescher at s2005.tu-chemnitz.de
Thu Mar 25 13:41:23 EDT 2010


> As you see, the traceback only starts from function c, which handles the 
> exception.
> It doesn't show main(), a() and b(), which might however be (and are, in 
> my case) critical to diagnose the severity of the problem (since many 
> different paths would lead to calling c()).

This results in the way the tb is created.

If an exception occours, and there is no one who handles it in the
current function, a traceback object is created. Because the the calling
function could have a try-except clause, the function returns with NULL
and an set exception. Now if there is no one to handle the exception, a
traceback object is created and linked with the existing one.

In your case does the traceback start from the function c, because no
exception occoured in main() etc. You catched it. If you want to
determine the calling path, you can take a look at the encapsuled frame
in the tb. 

Best





More information about the Python-list mailing list