Last active
January 1, 2024 19:38
-
-
Save txomon/f170cb02d4362d2887cb89706147c9a6 to your computer and use it in GitHub Desktop.
Snippet to ease debugging exceptions
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, traceback | |
def exception_hook(e, value, tb): | |
for line in traceback.TracebackException( | |
type(value), value, tb, capture_locals=True | |
).format(chain=True): | |
print(line, end="") | |
sys.excepthook = exception_hook |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment