On this page
traceback.walk_stack
Prev: traceback.TracebackException | Up: traceback | Next: traceback.walk_tb
Rel: traceback.clear_frames, traceback.extract_stack, traceback.extract_tb, traceback.format_exc
Ref: docs.python.org — traceback.walk_stack
Tags: #public #python3 #stdlib #traceback
Import
import traceback
from traceback import walk_stack
Signature & Overview
traceback.walk_stack(f)
Walk a stack yielding the frame and line number for each frame.
Usage
import traceback
pairs = list(traceback.walk_stack(None))
assert len(pairs) >= 1 and isinstance(pairs[0][1], int)
Gotchas
- Yields
(frame, lineno)pairs walking outward from the current frame.
REPL Inspect
from traceback import walk_stack
help(walk_stack)
Linked from
Related notes
- tuts/python3/stdlib_module/traceback/TracebackException Linked here; links to this page; shared tags: #stdlib, #traceback
- tuts/python3/stdlib_module/traceback/walk_tb Linked here; links to this page; shared tags: #stdlib, #traceback
- tuts/python3/stdlib_module/traceback Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/traceback/clear_frames Linked here; shared tags: #stdlib, #traceback
- tuts/python3/stdlib_module/traceback/extract_stack Linked here; shared tags: #stdlib, #traceback
- tuts/python3/stdlib_module/traceback/extract_tb Linked here; shared tags: #stdlib, #traceback
- tuts/python3/stdlib_module/traceback/format_exc Linked here; shared tags: #stdlib, #traceback
- tuts/python3/stdlib_module/traceback/format_exception shared tags: #stdlib, #traceback
- tuts/python3/stdlib_module/traceback/format_exception_only shared tags: #stdlib, #traceback
- tuts/python3/stdlib_module/traceback/format_list shared tags: #stdlib, #traceback