[IPython-user] debugging in ipython
Thu Mar 19 11:21:34 CDT 2009
On Thu, Oct 23, 2008 at 2:51 AM, Tom Krauss <firstname.lastname@example.org> wrote:
> Note, I have resolved these questions through other channels and
> thought a follow-up post might be appropriate.
> I think IPython already supports some degree of tab completion and
> syntax coloration while debugging in both 0.8.4 and 0.9.1.
> One way to so this is to do
> In : %run -d myscript.py
> ipdb> b somefile.py:linenumber
> ipdb> c
> and it stops at the breakpoint you set. At this point a syntax
> colored source listing is printed and I'm able to use tab completion
> to print variables
> ipdb> p some[TAB] gets expanded to
> ipdb> p somevariable
> I've tried this and it works great! This technique does not require
> you to touch any code (e.g. inserting pdb.set_trace() or raise an
> exception) to set a breakpoint at an arbitrary point. Also, the -i
> option to %run allows my script to work with existing variables in
> the IPython namespace.
Thanks so much for this followup post. This is exactly what I was
looking for in order to have some sort of breakpointing system for
emacs. Somehow I had missed the exactly how this worked. I was
thinking of hacking the stream that was sent to ipython, but that was
getting beyond my time, and probably my skills.
Thanks again, as you can probably tell I am thrilled. I will post
whatever I come up with on the list if anyone would be interested.
The idea is something like in wingide, you click (or for emacs use a
keybinding) to set a breakpoint in a particular line, and all the
breakpoints in various files are remembered and set automatically when
you run the file. Well, that is the idea anyway.
More information about the IPython-user