pdb.set_trace()
pdb.set_trace() is a Python function in the Pdb Module category. Sets a breakpoint in code. When executed, drops into the interactive debugger. The syntax is pdb.set_trace(*, header=None). Returns: None (starts debugger). A typical example: def buggy_function(x):
import pdb; pdb.set_trace() # Debugger starts here
return 1 / x. A close sibling is pdb.run(), which runs a Python statement under debugger control. A close sibling is pdb.runcall(), which calls a function under debugger control. A close sibling is pdb.pm(), which starts the debugger at the site of the most recent exception (post-mortem debugging). A close sibling is pdb.post_mortem(), which starts the debugger at the given traceback object for post-mortem debugging. More about this category: Interactive debugger — set_trace, run, pm, post_mortem. Related Pdb Module entries: pdb.run(), pdb.runcall(), pdb.pm(), pdb.post_mortem(). This page is part of the free Python Reference documentation covering 978+ functions, methods, and modules with examples and parameter details.