Skip to main content

Module traceback

Module traceback 

Source
Expand description

Rich exception tracebacks with source code, locals, frame suppression, panic hook. Traceback – exception traceback rendering. Equivalent to Rich’s traceback.py.

Provides data structures for representing tracebacks and a Traceback renderable that displays them with Rich formatting, complete with source code context, local variable tables, and styled box-drawn borders.

§Theme keys used

KeyStyle
traceback.borderborder of the outer and inner boxes
traceback.title“Traceback (most recent call last)” title
traceback.errorexception type name
traceback.error_markthe “❱” marker on the error line
traceback.filenamefile paths in frame headers
traceback.line_noline numbers in source context
traceback.locals_headerheader of the locals sub-table

Structs§

Frame
A single frame in a traceback.
Stack
A stack of frames (one exception level).
Trace
Full trace data.
Traceback
Renders a traceback with Rich formatting.

Functions§

install
Install a panic hook that renders Rich-formatted tracebacks to stderr.