Pages

Mar 12, 2015

Use pdb to debug Python code

use pdb to debug python code:


some (not all) commands of pdb:
h: see the entire help list

l: l(ist) [first [,last]]
List source code for the current file.
Without arguments, list 11 lines around the current line or continue the previous listing.
With one argument, list 11 lines starting at that line.
With two arguments, list the given range; if the second argument is less than the first, it is a count. 

s:
Execute the current line, stop at the first possible occasion
(either in a function that is called or in the current function).

c
Continue execution, only stop when a breakpoint is encountered.

b
b(reak) ([file:]lineno | function) [, condition]

p: p expression
Print the value of the expression.

for more information: https://docs.python.org/2/library/pdb.html

No comments:

Post a Comment