[IPython-user] ipdb

Ryan Krauss ryanlists at gmail.com
Thu Jan 26 16:27:18 CST 2006


Perfect.  Thanks.

On 1/26/06, Fernando Perez <Fernando.Perez at colorado.edu> wrote:
> Ryan Krauss wrote:
> > I set %pdb yesterday and ended up using the very nice new ipdb with
> > tab completion.  Now I am spoiled.  I used pdb.set_trace() in one of
> > my scripts and I just don't know if I can use regular pdb anymore :).
> > Is there a way to put a line in a script that calls ipdb like
> > pdb.set_trace()?
>
> If you look at set_trace, it's just this:
>
> In [1]: import pdb
>
> In [2]: pdb.set_trace??
> Type:           function
> Base Class:     <type 'function'>
> String Form:    <function set_trace at 0x4041ca3c>
> Namespace:      Interactive
> File:           /usr/lib/python2.3/pdb.py
> Definition:     pdb.set_trace()
> Source:
> def set_trace():
>      Pdb().set_trace()
>
>
> So you can do the same thing with IPython's debugger:
>
>
>
> In [5]: from  IPython.Debugger import Pdb
>
> In [6]: def set_trace():
>     ...:     Pdb().set_trace()
>     ...:
>     ...:
>
> In [7]: set_trace()
> --Return--
> None
> <ipython console> in set_trace()
>
> ipdb> q
>
>
> Cheers,
>
> f
>




More information about the IPython-user mailing list