How to get inner exception traceback

Thomas Guettler hv at tbz-pariv.de
Thu Apr 24 07:20:29 EDT 2008


Hi,

How can you get the traceback of the inner exception?

try:
     try:
         import does_not_exit
     except ImportError:
         raise Exception("something wrong")
except:
     ...


Background: In Django some exceptions are caught and a new
exception gets raised. Unfortunately the real error is hard
to find. Sometimes I help myself and change (in this example)
ImportError to e.g. IOError and then I can see the real root
of the problem. But maybe there is a way to get the inner
exception and its traceback. This could be displayed in the
debug view.

  Thomas

-- 
Thomas Guettler, http://www.thomas-guettler.de/
E-Mail: guettli (*) thomas-guettler + de



More information about the Python-list mailing list