[IPython-user] Cannot step debugger in IPython 0.9.1 under Python 2.6.2: Pdb instance has no attribute 'curframe'

Andreas Roehler andreas.roehler@online...
Tue May 26 14:48:17 CDT 2009


Jon Olav Vik wrote:
> I cannot step into scripts with "run -d"; ipython halts before the
> first line with "Pdb instance has no attribute 'curframe'". It fails
> even when debugging very simple files and with no user-specific
> customizations loaded, no .bash_profile and no PYTHONPATH, in a
> pristine directory so none of my files should override any defaults.
> "run" without -d option works. Plain Python also works as usual.
> 
> I'm not sure when this problem arose, but it may have been after an
> upgrade from the versions included with Ubuntu 8.04 (Python 2.5.2 and
> IPython 0.8.1? wild guess).
> 
> Any help would be greatly appreciated.
> 
> Best regards,
> Jon Olav
> 
> 
> -bash-3.00$ ipython
> /global/apps/python/2.6.2/lib/python2.6/site-packages/ipython-0.9.1-py2.6.egg/IPython/Magic.py:38:
> DeprecationWarning: the sets module is deprecat
>  from sets import Set
> Python 2.6.2 (r262:71600, Apr 27 2009, 23:59:28)
> Type "copyright", "credits" or "license" for more information.
> 
> IPython 0.9.1 -- An enhanced Interactive Python.
> 
> [...]
> 
> In [1]: cat debug_me.py
> """Check if the IPython debugger has problems"""
> 
> x = 2 + 2
> print x / 0
> 
> In [2]: run -d debug_me.py
> ---------------------------------------------------------------------------
> AttributeError                            Traceback (most recent call last)
> 
> /home/jonvi/<ipython console> in <module>()
> 
> /global/apps/python/2.6.2/lib/python2.6/site-packages/ipython-0.9.1-py2.6.egg/IPython/iplib.pyc
> in ipmagic(self, arg_s)
>    951         else:
>    952             magic_args = self.var_expand(magic_args,1)
> --> 953             return fn(magic_args)
>    954
>    955     def ipalias(self,arg_s):
> 
> /global/apps/python/2.6.2/lib/python2.6/site-packages/ipython-0.9.1-py2.6.egg/IPython/Magic.pyc
> in magic_run(self, parameter_s, runner)
>   1613                     maxtries = 10
>   1614                     bp = int(opts.get('b',[1])[0])
> -> 1615                     checkline = deb.checkline(filename,bp)
>   1616                     if not checkline:
>   1617                         for bp in range(bp+1,bp+maxtries+1):
> 
> /global/apps/python/2.6.2/lib/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'
> _______________________________________________
> IPython-user mailing list
> IPython-user@scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-user
> 

With

Python 2.5.1 (r251:54863, Dec  1 2008, 17:47:46)
...
IPython 0.8.1 -- An enhanced Interactive Python.

I get

In [34]: run debug_me.py
---------------------------------------------------------------------------
<type 'exceptions.ZeroDivisionError'>     Traceback (most recent call last)

MY-PATH/debug_me.py in <module>()
      5
      6 x = 2 + 2
----> 7 print x / 0
      8
      9

<type 'exceptions.ZeroDivisionError'>: integer division or modulo by zero
WARNING: Failure executing file: <debug_me.py>

Seems a bug in IPython.

Andreas


More information about the IPython-user mailing list