python -m pdb myscript.pypython -m pdb -m mymodule.cliimport pdb
def make_bread():
pdb.set_trace()
return "I don't have time"
print(make_bread())if you are using Python 3.7+ then you can simply use the breakpoint() built-in function. It automatically imports pdb and calls pdb.set_trace().
? will show command reference, here's list of common commands
(Pdb) ?c
c(ont(inue))
Continue execution, only stop when a breakpoint is encountered.
(Pdb) ?w
w(here)
Print a stack trace, with the most recent frame at the bottom.
An arrow indicates the "current frame", which determines the
context of most commands. 'bt' is an alias for this command.if needs more detailed description
"help pdb" shows the full pdb documentation