[IPython-user] How to enter debugging mode in ipython

Gael Varoquaux gael.varoquaux@normalesup....
Wed Oct 22 16:26:39 CDT 2008


On Wed, Oct 22, 2008 at 03:01:26PM +0800, Wong, Shin Guey wrote:
> Currently the automatic enter pdb mode is very useful, thanks for it!!!
> But I am looking for method similar to the pdb.set_trace() function in
> ipython to enter pdb mode. I know that I can install ipdb and use
> ipdb.set_trace(). But since ipython already come with the pdb itself, I
> don't want to install another package 'ipdb' again. Actually I had
> tried to install the ipdb but the ipdb behave a bit different from the
> pdb in ipython.

> Any clue for this? I had look through the documentation but doesn't
> found any manual to do this.

I am not sure what you want to do, but I use "%debug" heavily.

 1) Post-mortem: after running a function (or script) that raised an
    unhandled exception, to understand the exception better.

 2) To introspect some code at a given position: insert an exception (eg
    1/0), run the code, and use "%debug" to go to the position where you
    inserted the exception.

HTH,

Gaël



More information about the IPython-user mailing list