traceback.format_exc() returns 'None\n'?!

Sean DiZazzo sean.dizazzo at gmail.com
Thu Aug 31 17:04:55 EDT 2017


Python 2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 12:39:47) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import traceback
>>> tb = traceback.format_exc()
>>> type(tb)
<type 'str'>
>>> tb
'None\n'
>>> 


Shouldn't it just return None itself?  Why a string with a newline?

Interested if there is an actual reason for this behavior or if it should be reported as a bug.

~Sean



More information about the Python-list mailing list