[IPython-user] ipdb
Fernando Perez
Fernando.Perez at colorado.edu
Thu Jan 26 15:58:33 CST 2006
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