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

Robin robince@gmail....
Wed Oct 22 02:38:19 CDT 2008


On Wed, Oct 22, 2008 at 8:01 AM, Wong, Shin Guey
<shin.guey.wong@intel.com> 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.

Hi,

I was in a similar situation and found that the way to do this is (I think):

from IPython.Debugger import Pdb
pdb = Pdb()
pdb.set_trace()

but this only works when the code is run from the Ipython interactive
interpreter (ie with %run).

>From watching the list, I gather most people don't bother with this,
but just put in a deliberate error where they want the trace (ie 1/0)
then with pdb on the debugger drops in there anyway... I've also
started to use this method...

Cheers

Robin


More information about the IPython-user mailing list