twisteroid ambassador <twisteroid.ambassa...@gmail.com> added the comment:

The difference is because you grabbed and print()ed the exception themselves in 
Script 2, while in Script 1 you let Python's built-in unhandled exception 
handler (sys.excepthook) print the traceback for you.

If you want a traceback, then you need to print it yourself. Try something 
along the lines of this:

    traceback.print_tb(result.__traceback__)

or:

    traceback.print_exception(type(result), result, result.__traceback__)

or if you use the logging module:

    logging.error('Unexpected exception', exc_info=result)


reference: 
https://stackoverflow.com/questions/11414894/extract-traceback-info-from-an-exception-object

----------
nosy: +twisteroid ambassador

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue36636>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to