Human-readable HTML tracebacks for Python exceptions
Maintained. Last release 3 months ago, commits in 7 of the last 26 weeks. Weaker on contributor spread.
pip install traceriteTracebacks for Humans (and Machines)
Fixing bugs is easier with well formatted error messages. Console, HTML and JSON.
TraceRite formats Python errors in Jupyter notebooks, in plain HTML, and in the terminal: rich variable inspection (left), plus syntax-error highlighting and compact terminal tracebacks (right).
Installation
Python scripts or REPL
pip install tracerite
import tracerite; tracerite.load()
Any error message after that call will be prettified. Handles any syntax errors and uncaught exceptions, even captures logging.exception (optionally).
IPython or Jupyter Notebook
%pip install tracerite
%load_ext tracerite
This enables tracebacks in text or HTML format depending on where you are running. Add to ~/.ipython/profile_default/startup/tracerite.ipy to make it load automatically for all your ipython and notebook sessions. Alternatively, put the two lines at the top of your notebook.
If you are using UV, consider running with your other dependencies:
uvx --with tracerite --with numpy jupyter lab
FastAPI
Add the extension loader at the top of your app module:
from tracerite import patch_fastapi; patch_fastapi()
This monkeypatches Starlette error handling and FastAPI routing to work with HTML tracebacks. Note: this runs regardless of whether you are in production mode or debug mode, so you might want to call that function only conditionally in the latter.
Sanic
Comes with TraceRite built in. HTML reports are available in debug mode, and console messages are always formatted by Tracerite.
Clarity in complex situations
What you see is always in the order it was executed
In cases 2 (left) and 3 (right) we mark the whole with statement but not the block, and emphasize the expression responsible (helpful when there are more than one). In case 3 we include the executed block body in context shown (up to 20 lines).
Python 3.11+ concurrent execution errors with