Getting Extended Exception Information

Benjamin Niemann b.niemann at
Wed Jul 21 09:36:14 CEST 2004

Cy Edmunds wrote:
> In an exception handler I can get the error message by just converting the
> Exception to a string. How do I get the entire message including the call
> stack information that I see printed out with an uncaught exception?
what you are looking for is probably:

import traceback

   stackdump = "".join(traceback.format_exception(sys.exc_type,
             sys.exc_value, sys.exc_traceback))
   print stackdump

More information about the Python-list mailing list