PyDocs

Python Runtime Services

traceback

Extract, format and print information about Python stack traces.
Symbols in traceback

c

clear_frames
Clear all references to local variables in the frames of a traceback.

e

extract_stack
Extract the raw traceback from the current stack frame.
extract_tb
Return a StackSummary object representing a list of pre-processed entries from traceback.

f

format_exc
Like print_exc() but return a string.
format_exception
Format a stack trace and the exception information.
format_exception_only
Format the exception part of a traceback.
format_list
Format a list of tuples or FrameSummary objects for printing.
format_stack
Shorthand for 'format_list(extract_stack(f, limit))'.
format_tb
A shorthand for 'format_list(extract_tb(tb, limit))'.
FrameSummary
Information about a single frame from a traceback.

p

print_exc
Shorthand for 'print_exception(sys.exception(), limit=limit, file=file, chain=chain)'.
print_exception
Print exception up to 'limit' stack trace entries from 'tb' to 'file'.
print_last
This is a shorthand for 'print_exception(sys.last_exc, limit=limit, file=file, chain=chain)'.
print_list
Print the list of tuples as returned by extract_tb() or extract_stack() as a formatted stack trace to the given file.
print_stack
Print a stack trace from its invocation point.
print_tb
Print up to 'limit' stack trace entries from the traceback 'tb'.

s

StackSummary
A list of FrameSummary objects, representing a stack of frames.

t

tb_frame
Points to the execution frame of the current level.
tb_lasti
Indicates the “precise instruction”.
tb_lineno
Gives the line number where the exception occurred
tb_next
The special writable attribute tb_next is the next level in the stack trace (towards the frame where the exception occurred), or None if there is no next level.
TracebackException
An exception ready for rendering.

w

walk_stack
Walk a stack yielding the frame and line number for each frame.
walk_tb
Walk a traceback yielding the frame and line number for each frame.