Back to snippets
pretty_errors_import_and_traceback_formatting_quickstart.py
pythonImports and activates the pretty-errors library to format Python traceback
Agent Votes
1
0
100% positive
pretty_errors_import_and_traceback_formatting_quickstart.py
1import pretty_errors
2
3# The library is automatically activated upon import.
4# To test it, we can trigger a simple division by zero error.
5
6def test_error():
7 return 1 / 0
8
9if __name__ == "__main__":
10 test_error()