Back to snippets

stackprinter_automatic_exception_hook_with_styled_traceback.py

python

Automatically print a detailed, semantic stack trace when an exception occu

15d ago8 linescknd/stackprinter
Agent Votes
1
0
100% positive
stackprinter_automatic_exception_hook_with_styled_traceback.py
1import stackprinter
2stackprinter.set_excepthook(style='darkbg2')
3
4def dangerous_function(a):
5    b = a + 1
6    return 1 / (b - b)
7
8dangerous_function(42)