breaking out to the debugger (other than x=1/0 !)

bdb112 boyd.blackwell at gmail.com
Fri Oct 23 18:02:22 CEST 2009


After a while programming in python, I still don't know how to break
out to the debugger other than inserting an instruction to cause an
exception.
x=1/0

In IDL one woudl write

stop,'reason for stopping...'
at which point you can inspect locals (as in pdb) and continue (but
you can't with pdb if python stopped because of an exception)

I am using ipython -pylab -pdb (python 2.5,2.6)
Yes, I realise that I could start with the debugger, and set break
points, but that can be slower and sometimes cause problems, and I
like ipython's magic features.

Also, I don't know how to stop cleanly handing control back to ipython
inside a program - e.g. after printing help text.



More information about the Python-list mailing list