[Ipython-tickets] [IPython] #144: Exception after executing %edit
IPython
ipython-tickets@scipy....
Tue Apr 17 04:49:09 CDT 2007
#144: Exception after executing %edit
----------------------+-----------------------------------------------------
Reporter: mstarzyk | Owner: fperez
Type: defect | Status: new
Priority: normal | Milestone:
Component: ipython | Version:
Severity: normal | Keywords:
----------------------+-----------------------------------------------------
Hi, there is a problem with the magic command {{{%edit}}} on win32.
This bug happens in IPython release 0.8.0 and is still present
in the svn trunk (checked r2245).
{{{
Python 2.5.1c1 (r251c1:54692, Apr 5 2007, 09:19:18) [MSC v.1310 32 bit
(Intel)]
Type "copyright", "credits" or "license" for more information.
IPython 0.8.0 -- An enhanced Interactive Python.
? -> Introduction to IPython's features.
%magic -> Information about IPython's 'magic' % functions.
help -> Python's own help system.
object? -> Details about 'object'. ?object also works, ?? prints more.
In [1]: ed
IPython will make a temporary file named:
c:\docume~1\mast\ustawi~1\temp\ipython_edit_jmhr1d.py
Editing... done. Executing edited code...
1
---------------------------------------------------------------------------
<type 'exceptions.IndexError'> Traceback (most recent call
last)
<type 'exceptions.IndexError'>: tuple index out of range
WARNING: Failure executing file:
<c:\docume~1\mast\ustawi~1\temp\ipython_edit_jmhr1d.py>
Out[1]: 'def xx():\n print 10\n'
}}}
The problem is caused by a call to safe_execfile with not enough
params. safe_execfile expects at least 3 non-keyword params (references
{{{where[0]}}} and {{{where[1]}}}). See below:
{{{
Magic.py:2254:
self.shell.safe_execfile(filename,self.shell.user_ns)
}}}
{{{
iplib.py:2484:
def safe_execfile(self,fname,*where,**kw):
... snipped some code ...
iplib.py:2590:
if sys.platform == 'win32':
# Work around a bug in Python for Windows. The bug was
# fixed in in Python 2.5 r54159 and 54158, but that's still
# SVN Python as of March/07. For details, see:
# http://projects.scipy.org/ipython/ipython/ticket/123
exec file(fname) in where[0],where[1]
}}}
--
Ticket URL: <http://projects.scipy.org/ipython/ipython/ticket/144>
IPython <http://ipython.scipy.org>
The IPython interactive Python system
More information about the Ipython-tickets
mailing list