import sys
try:
i = int("Hallo")
except:
(type, value, traceback) = sys.exc_info()
print("Type: ", type)
print("Value: ", value)
print("traceback: ", traceback)
Warning: Assigning the traceback return value to a local variable in a function that is handling an exception will cause a circular reference.
exctype, value = sys.exc_info()[:2]