breaking out to the debugger (other than x=1/0 !)
Diez B. Roggisch
deets at nospam.web.de
Fri Oct 23 18:07:00 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
> 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.
import pdb; pdb.set_trace()
Of course that can't be deleted as breakpoint - but it suits me well.
More information about the Python-list