PyDocs

Nav

Debugging and profiling

set_trace

pdb

function (source)
  • set_trace(*, header=None, commands=None)
Enter the debugger at the calling stack frame.

This is useful to hard-code a breakpoint at a given point in a
program, even if the code is not otherwise being debugged (e.g. when
an assertion fails). If given, *header* is printed to the console
just before debugging begins. *commands* is an optional list of
pdb commands to run when the debugger starts.
Changed in 3.7, 3.13, 3.14
  • 3.7: The keyword-only argument header.
  • 3.13: set_trace() will enter the debugger immediately, rather than on the next line of code to be executed.
  • 3.14: The commands argument.
0 Examples
No examples for pdb/set_trace.
See Also
No see-alsos for pdb/set_trace
0 Notes
No notes for set_trace