|
import pdb; pdb.set_trace()
|
Within the code
|
|
python -m pdb file.py
|
From the command line
|
|
p
|
print variable value
|
|
pp
|
pretty print
|
|
a
|
print input args of function
|
|
locals
|
show local variables
|
|
n
|
next
|
|
s
|
step inside a function
|
|
c
|
continue
|
|
r
|
run until func returns
|
|
<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
|
|
b 45
|
set on line 45
|
|
b 45, x == 'abc'
|
set with condition
|
|
b
|
list current breakpoints
|
|
b funcName
|
set breakpoint in function
|
|
b file.py:41
|
set on line 41 of file.py
|
|
cl
|
clear all breakpoints
|
|
cl 42
|
clear breakpoint #42
|
|
tbreak ...
|
hit only once, syntax as
b |
|
disable 42
|
turn off breakpoint #42
|
|
enable 42
|
enable breakpoint #42
|
|
ignore 42 [N]
|
ignore bp#42 N times
|
|
condition 42 x=='abc'
|
set condition to bp (no condition = remove it)
|
No comments yet.
Cheatography n. The art of mapping complex subjects into clear, instantly navigable reference guides.