Turn Python stack traces into cleaner, more readable output
pip install philiprehberger-stacktraceTurn Python stack traces into cleaner, more readable output.
pip install philiprehberger-stacktrace
from philiprehberger_stacktrace import install
install() # replaces sys.excepthook
from philiprehberger_stacktrace import format_exception
try:
risky_operation()
except Exception as e:
report = format_exception(e)
print(report.short()) # one-line summary
print(report.detailed()) # colored with source context
| Function / Class | Description |
|---|---|
install(color=True, context=2, hide_stdlib=True) | Replace sys.excepthook |
format_exception(exc) | Returns ExceptionReport |
report.short() | One-line summary |
report.detailed(color, context, hide_stdlib) | Full formatted output |
pip install -e .
python -m pytest tests/ -v
If you find this project useful: