Created
February 17, 2017 00:14
-
-
Save WilliamQLiu/388d93748970de82e2e00a519afa015b to your computer and use it in GitHub Desktop.
Python debugging an exception
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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