Right now, I catch the exception in the except Exception: clause, and do print(exception). The result provides no information since it always prints
except Exception:
print(exception)
Try
try: print undefined_var except Exception as e: print(e)
this will print the representation given by e.__str__():
e.__str__()
"name 'undefined_var' is not defined"
you can also use:
print(repr(e))
which will include the Exception class name:
"NameError("name 'undefined_var' is not defined",)"