Skip to content

Instantly share code, notes, and snippets.

@WilliamQLiu
Created February 17, 2017 00:14
Show Gist options
  • Save WilliamQLiu/388d93748970de82e2e00a519afa015b to your computer and use it in GitHub Desktop.
Save WilliamQLiu/388d93748970de82e2e00a519afa015b to your computer and use it in GitHub Desktop.
Python debugging an exception
import sys
import traceback
try:
temp = None
temp = 1
except Exception as e:
print "Caused exception with %s" % str(e)
print "Caused exception with %s" % repr(e)
etype, value, tb = sys.exc_info()
print ''.join(traceback.format_exception(etype, value, tb))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment