An interactive debugger which allows you to interact via the python shell at specific places within your code.
The two important parts are
import pdb
--> Use the pdb library
pdb.set_trace()
--> Use this in each part of the code where you want to invoke the debugger
For instance, you might have a script which looks like this
import mylibrary
var1 = mylibrary.getvars()
Instead of using a heap of print var1
, print type(var1)
. print dir(var1)
etc to understand what is happening, you could instead do this
import mylibrary
import pdb
var1 = mylibrary.getvars()
pdb.set_trace()
This will drop you into a python debugger shell
q
will exit the debugger and continue running your program
further reading
https://web.stanford.edu/class/physics91si/2013/handouts/Pdb_Commands.pdf