Python PDB Debug

Python PDB Debug

Python PDB Debug

Install the pdb lib
sudo pip install ipdb

Set the breakpoint
import ipdb; ipdb.set_trace()

Manual

- “import pdb” or “import ipdb as pdb“, then “pdb.set_trace()“
- n (next)
- ENTER (repeat previous)
- q (quit)
- p <variable> (print value)
- c (continue)
- l (list where you are)
- s (step into subroutine)
- r (continue till the end of the subroutine)
- ! (python command)

Reference

[1]https://pythonconquerstheuniverse.wordpress.com/2009/09/10/debugging-in-python/
[2]http://georgejhunt.com/olpc/pydebug/pydebug/ipdb.html