On this page
  1. traceback.print_list
  2. Import
  3. Signature & Overview
  4. Usage
  5. Gotchas
  6. REPL Inspect

traceback.print_list

Prev: traceback.print_last | Up: traceback | Next: traceback.print_stack
Rel: traceback.clear_frames, traceback.extract_stack, traceback.extract_tb, traceback.format_exc
Ref: docs.python.org — traceback.print_list
Tags: #public #python3 #stdlib #traceback


Import

import traceback
from traceback import print_list

Signature & Overview

traceback.print_list(extracted_list, file=None)

Print the list of tuples as returned by extract_tb() or extract_stack() as a formatted stack trace to the given file.

Usage

import io, traceback

buf = io.StringIO()
traceback.print_list([traceback.FrameSummary('x.py', 5, 'fn')], file=buf)
assert 'x.py' in buf.getvalue()

Gotchas

REPL Inspect

from traceback import print_list
help(print_list)

Linked from

Related notes