[IPython-user] using pdb with breakpoints
Nathan Huesken
ipython@lonely-star....
Sun Nov 8 14:16:22 CST 2009
Hi,
I am trying to use pdb. But I fail at using breakpoints.
I have this example python file:
test.py:
import numpy
print "Hi"
print "Doing some calculation ..."
1/0
Now I do:
ipython
In [1]: pdb
Automatic pdb calling has been turned ON
In [2]: run test.py
Hi
Doing some calculation ...
(...)
ZeroDivisionError: integer division or modulo by zero
(...)
----> 6 1/0
ipdb> break 4
Breakpoint 1 at /home/ls/test.py:4
In [3]: run -d test.py
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
/home/ls/test.py in <module>()
----> 1
2
3
4
5
/usr/lib64/python2.6/site-packages/IPython/iplib.pyc in ipmagic(self, arg_s)
1180 else:
1181 magic_args = self.var_expand(magic_args,1)
-> 1182 return fn(magic_args)
1183
1184 def ipalias(self,arg_s):
/usr/lib64/python2.6/site-packages/IPython/Magic.pyc in magic_run(self, parameter_s, runner, file_finder)
1631 maxtries = 10
1632 bp = int(opts.get('b',[1])[0])
-> 1633 checkline = deb.checkline(filename,bp)
1634 if not checkline:
1635 for bp in range(bp+1,bp+maxtries+1):
/usr/lib64/python2.6/pdb.pyc in checkline(self, filename, lineno)
450 line or EOF). Warning: testing is not comprehensive.
451 """
--> 452 line = linecache.getline(filename, lineno, self.curframe.f_globals)
453 if not line:
454 print >>self.stdout, 'End of file'
AttributeError: Pdb instance has no attribute 'curframe'
> /usr/lib64/python2.6/pdb.py(452)checkline()
451 """
--> 452 line = linecache.getline(filename, lineno, self.curframe.f_globals)
453 if not line:
What am I doing wrong (or is it a bug?)? How can I use ipython with pdb?
Thanks!
Nathan
More information about the IPython-user
mailing list