Python pdb Cheat Sheet
by ralienpp via cheatography.com/18926/cs/2027/
Invoking the debugger Breakpoints
import pdb; pdb.set_trace() Within the code b 45 set on line 45
python -m pdb file.py From the command line b 45, x == 'abc' set with condition
b list current breakpoints
Basic commands
b funcName set breakpoint in function
p print variable value b file.py:41 set on line 41 of file.py
pp pretty print cl clear all breakpoints
a print input args of function cl 42 clear breakpoint #42
locals show local variables tbreak ... hit only once, syntax as b
n next
disable 42 turn off breakpoint #42
s step inside a function
enable 42 enable breakpoint #42
c continue
ignore 42 [N] ignore bp#42 N times
r run until func returns
condition 42 x=='abc' set condition to bp (no condition = remove it)
<Enter> repeat previous command
l print nearby code
l from,to print code between lines
w where am I + traceback
u up the call stack
d down the call stack
q quit
h help
h command info about a command
By ralienpp Published 18th June, 2014. Sponsored by Readability-Score.com
cheatography.com/ralienpp/ Last updated 18th June, 2014. Measure your website readability!
Page 1 of 1. https://readability-score.com