getting tracebacks from traceback objects
Kent Johnson
kent37 at tds.net
Fri Jun 24 06:56:39 EDT 2005
Michael P. Soulier wrote:
> Hello,
>
> For a GUI app I've tried resetting sys.excepthook to my own
> exceptionhandler bound method, which accepts a type, value and traceback
> object.
>
> Now, the traceback module has print_exc and format_exc methods that are
> supposed to take a traceback object and return a formatted traceback
> like the default output. Unfortunately I keep getting 'None' out of
> them. Not sure why.
You are misreading the docs. print_exc() and format_exc() take args of [limit[, file]] not a traceback.
> I want format_exe especially, since I don't want to print to stdout, I
> want to provide the traceback in a popup dialog.
Use format_exception() or pass a StringIO object as the file parameter to print_exc().
Kent
More information about the Python-list
mailing list