import sys
try:
raise Exception('foobar')
except:
info = sys.exc_info()
print(type(e[2])) # <class 'traceback'>
help(traceback) # NameError: name 'traceback' is not defined
What exactly is the type of the traceback objects that Python uses for exception reporting?
The docs on sys.exc_info mention the Reference Manual, but while I've found plenty of information on how to manipulate traceback instances, I want to be able to access the type (class) itself.
__name__ == 'traceback'
doesn't mean that in the global namespace,traceback
refers to that class. – Trautmantype(e[2])
, by the way. – Rembert