Entering function def generates inexplicable syntax error

Bug #565466 reported by Mitch Berkson
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
IPython
Incomplete
Undecided
Unassigned

Bug Description

Interactively entering the following function definition causes a syntax error on line 5:

def g(b):
    if b:
        x = b + 10
        return x
    else:
        return b

Error:
   File "<ipython console>", line 5
     lse:
       ^
SyntaxError: invalid syntax

Python 2.5
IPython 0.10
Ubuntu Hardy

Revision history for this message
Fernando Perez (fdo.perez) wrote :

That's very odd. Unfortunately I can't reproduce it here. I don't have a Hardy box, but on a Karmic one with 0.10 and python 2.5 (2.5.4 to be exact), everything works as expected:

Python 2.5.4 (r254:67916, Jan 20 2010, 21:44:03)
Type "copyright", "credits" or "license" for more information.

IPython 0.10 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object'. ?object also works, ?? prints more.

In [1]: def g(b):
   ...: if b:
   ...: x = b + 10
   ...: return x
   ...: else:
   ...: return b
   ...:
   ...:

I haven't the foggiest idea what could be causing this, and without a way to even reproduce it (I've never seen something like it before either), I'm not sure I can work on fixing it.

Is this on a stock Hardy install with the system python and ipython, or is it using a custom install?

Revision history for this message
Mitch Berkson (mitch-bermita) wrote :

This is on a stock AWS Hardy instance (alestic/ubuntu-8.04-hardy-base-20081222.manifest.xml) with the stock system python and ipython which I installed from the tar at http://ipython.scipy.org/dist/

Revision history for this message
Fernando Perez (fdo.perez) wrote : Re: [Bug 565466] Re: Entering function def generates inexplicable syntax error

On Sun, Apr 18, 2010 at 5:52 AM, Mitch Berkson <email address hidden> wrote:
> This is on a stock AWS Hardy instance (alestic/ubuntu-8.04-hardy-
> base-20081222.manifest.xml) with the stock system python and ipython
> which I installed from the tar at http://ipython.scipy.org/dist/

OK, thanks for the info. I'm leaving it open for reference, though
I'm kind of lost as to what could be possibly causing it. Perhaps
someone will find it and suggest a pointer to the root cause.

I unfortunately don't have the time right now to build a virtual
environment to set up a Hardy test instance, sorry.

Cheers,

f

Changed in ipython:
status: New → Confirmed
status: Confirmed → Incomplete
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.