[issue1860] traceback.print_last fails
Amaury Forgeot d'Arc
report at bugs.python.org
Thu Jan 17 14:59:35 CET 2008
Amaury Forgeot d'Arc added the comment:
> traceback.print_last() depends on the existence of sys.last_type
Yes, that is exactly as documented:
>>> help(traceback.print_last)
Help on function print_last in module traceback:
print_last(limit=None, file=None)
This is a shorthand for 'print_exception(sys.last_type,
sys.last_value, sys.last_traceback, limit, file)'.
Furthermore, in the doc:
http://docs.python.org/dev/library/sys.html#sys.last_type
"... they are set when an exception is not handled ..."
In your script, you *are* handling the exception.
Your script really should use traceback.print_exc() instead.
BTW, your patch basically makes print_last() identical to print_exc()...
----------
nosy: +amaury.forgeotdarc
resolution: -> invalid
status: open -> closed
__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue1860>
__________________________________
More information about the Python-bugs-list
mailing list