[IPython-user] using pdb with breakpoints

Jon Olav Vik jonovik@gmail....
Mon Nov 9 17:08:17 CST 2009


Nathan Huesken <ipython <at> lonely-star.org> writes:

> I am trying to use pdb. But I fail at using breakpoints.

Your basic problem is that "run -d" is broken in some version combinations of 
IPython/Python. See here for a workaround (pydb):
https://bugs.launchpad.net/ipython/+bug/381069

The usual way to use breakpoints in IPython is either e.g. "run -d -b 3 
test.py" (setting a breakpoint on line 3) or "run -d test.py", stepping in 
(debugger command "s") and setting new breakpoints with debugger command "b". 
For post-mortem debugging (your "1/0" example) I don't use breakpoints, because 
I don't think you can resume normal program flow after an uncaught exception. 
Instead normally just use the debugger to inspect variables or evaluate some 
expressions, then run my program again with a breakpoint just before the 
problem starts.

Hope this helps,
Jon Olav




More information about the IPython-user mailing list