Hi all:
I met an error while importing the flask:
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File
"/usr/lib/python2.4/site-packages/Flask-0.6-py2.4.egg/flask/__init__.py",
line 18
from .app import Flask, Request, Response
^
SyntaxError: invalid syntax
I gooled but no result, why this, please help.
Here is the detail info:
-bash-3.2$ cat /etc/issue
CentOS release 5.5 (Final)
Kernel \r on an \m
-bash-3.2$ python
Python 2.4.3 (#1, Nov 11 2010, 13:34:43)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-48)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import flask
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File
"/usr/lib/python2.4/site-packages/Flask-0.6-py2.4.egg/flask/__init__.py",
line 18
from .app import Flask, Request, Response
^
SyntaxError: invalid syntax
>>>
-bash-3.2$
BR
11/18/2010
LiChao wrote: > "/usr/lib/python2.4/site-packages/Flask-0.6-py2.4.egg/flask/__init__.py", > line 18 > from .app import Flask, Request, Response > ^ > SyntaxError: invalid syntax The intra-package references (module names starting with a dot) which Flask uses were only added in Python 2.5. You're using 2.4. -- Jonas
Hi all:
I met an error while importing the flask:
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File
"/usr/lib/python2.4/site-packages/Flask-0.6-py2.4.egg/flask/__init__.py",
line 18
from .app import Flask, Request, Response
^
SyntaxError: invalid syntax
I gooled but no result, why this, please help.
Here is the detail info:
-bash-3.2$ cat /etc/issue
CentOS release 5.5 (Final)
Kernel \r on an \m
-bash-3.2$ python
Python 2.4.3 (#1, Nov 11 2010, 13:34:43)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-48)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import flask
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File
"/usr/lib/python2.4/site-packages/Flask-0.6-py2.4.egg/flask/__init__.py",
line 18
from .app import Flask, Request, Response
^
SyntaxError: invalid syntax
>>>
-bash-3.2$
BR
11/18/2010
You're using Python 2.4. Relative imports using the "dot" syntax were introduced in 2.5. Upgrade to Python 2.5 or if that isn't possible then run your Flask apps inside virtualenv. http://docs.python.org/whatsnew/2.5.html#pep-328-absolute-and-relative-imports http://pypi.python.org/pypi/virtualenv On 18 November 2010 08:52, LiChao <sockpuppet.lea@gmail.com> wrote: > Hi all: > > I met an error while importing the flask: > Traceback (most recent call last): > File "<stdin>", line 1, in ? > File > "/usr/lib/python2.4/site-packages/Flask-0.6-py2.4.egg/flask/__init__.py", > line 18 > from .app import Flask, Request, Response > ^ > SyntaxError: invalid syntax > > I gooled but no result, why this, please help. > > Here is the detail info: > > > -bash-3.2$ cat /etc/issue > CentOS release 5.5 (Final) > Kernel \r on an \m > > > -bash-3.2$ python > Python 2.4.3 (#1, Nov 11 2010, 13:34:43) > [GCC 4.1.2 20080704 (Red Hat 4.1.2-48)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. >>>> import flask > Traceback (most recent call last): > File "<stdin>", line 1, in ? > File > "/usr/lib/python2.4/site-packages/Flask-0.6-py2.4.egg/flask/__init__.py", > line 18 > from .app import Flask, Request, Response > ^ > SyntaxError: invalid syntax >>>> > -bash-3.2$ > > > BR > 11/18/2010 > > >
virtualenv works! thanks. BR. Liszt 11/18/2010 On Thu, Nov 18, 2010 at 4:54 PM, danjac354@gmail.com <danjac354@gmail.com>wrote: > You're using Python 2.4. Relative imports using the "dot" syntax were > introduced in 2.5. Upgrade to Python 2.5 or if that isn't possible > then run your Flask apps inside virtualenv. > > > http://docs.python.org/whatsnew/2.5.html#pep-328-absolute-and-relative-imports > http://pypi.python.org/pypi/virtualenv > > > On 18 November 2010 08:52, LiChao <sockpuppet.lea@gmail.com> wrote: > > Hi all: > > > > I met an error while importing the flask: > > Traceback (most recent call last): > > File "<stdin>", line 1, in ? > > File > > "/usr/lib/python2.4/site-packages/Flask-0.6-py2.4.egg/flask/__init__.py", > > line 18 > > from .app import Flask, Request, Response > > ^ > > SyntaxError: invalid syntax > > > > I gooled but no result, why this, please help. > > > > Here is the detail info: > > > > > > -bash-3.2$ cat /etc/issue > > CentOS release 5.5 (Final) > > Kernel \r on an \m > > > > > > -bash-3.2$ python > > Python 2.4.3 (#1, Nov 11 2010, 13:34:43) > > [GCC 4.1.2 20080704 (Red Hat 4.1.2-48)] on linux2 > > Type "help", "copyright", "credits" or "license" for more information. > >>>> import flask > > Traceback (most recent call last): > > File "<stdin>", line 1, in ? > > File > > "/usr/lib/python2.4/site-packages/Flask-0.6-py2.4.egg/flask/__init__.py", > > line 18 > > from .app import Flask, Request, Response > > ^ > > SyntaxError: invalid syntax > >>>> > > -bash-3.2$ > > > > > > BR > > 11/18/2010 > > > > > > >
Hi , from flask import Flask, Request, Response You can try this? Cordialement, Beugin Thomas 2010/11/18 LiChao <sockpuppet.lea@gmail.com>: > Hi all: > > I met an error while importing the flask: > Traceback (most recent call last): > File "<stdin>", line 1, in ? > File > "/usr/lib/python2.4/site-packages/Flask-0.6-py2.4.egg/flask/__init__.py", > line 18 > from .app import Flask, Request, Response > ^ > SyntaxError: invalid syntax > > I gooled but no result, why this, please help. > > Here is the detail info: > > > -bash-3.2$ cat /etc/issue > CentOS release 5.5 (Final) > Kernel \r on an \m > > > -bash-3.2$ python > Python 2.4.3 (#1, Nov 11 2010, 13:34:43) > [GCC 4.1.2 20080704 (Red Hat 4.1.2-48)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. >>>> import flask > Traceback (most recent call last): > File "<stdin>", line 1, in ? > File > "/usr/lib/python2.4/site-packages/Flask-0.6-py2.4.egg/flask/__init__.py", > line 18 > from .app import Flask, Request, Response > ^ > SyntaxError: invalid syntax >>>> > -bash-3.2$ > > > BR > 11/18/2010 > > >
I should have said "update to *at least* Python 2.5". Flask will of course run on newer versions of Python 2.x, and it's better to have the latest stable version (2.7). On 18 November 2010 08:54, Thomas Beugin <kimkof@gmail.com> wrote: > Hi , > > from flask import Flask, Request, Response > > You can try this? > > Cordialement, > Beugin Thomas > > > > 2010/11/18 LiChao <sockpuppet.lea@gmail.com>: >> Hi all: >> >> I met an error while importing the flask: >> Traceback (most recent call last): >> File "<stdin>", line 1, in ? >> File >> "/usr/lib/python2.4/site-packages/Flask-0.6-py2.4.egg/flask/__init__.py", >> line 18 >> from .app import Flask, Request, Response >> ^ >> SyntaxError: invalid syntax >> >> I gooled but no result, why this, please help. >> >> Here is the detail info: >> >> >> -bash-3.2$ cat /etc/issue >> CentOS release 5.5 (Final) >> Kernel \r on an \m >> >> >> -bash-3.2$ python >> Python 2.4.3 (#1, Nov 11 2010, 13:34:43) >> [GCC 4.1.2 20080704 (Red Hat 4.1.2-48)] on linux2 >> Type "help", "copyright", "credits" or "license" for more information. >>>>> import flask >> Traceback (most recent call last): >> File "<stdin>", line 1, in ? >> File >> "/usr/lib/python2.4/site-packages/Flask-0.6-py2.4.egg/flask/__init__.py", >> line 18 >> from .app import Flask, Request, Response >> ^ >> SyntaxError: invalid syntax >>>>> >> -bash-3.2$ >> >> >> BR >> 11/18/2010 >> >> >> >
nope, still not work, I'll try to install a py25 on my local. On Thu, Nov 18, 2010 at 4:54 PM, Thomas Beugin <kimkof@gmail.com> wrote: > Hi , > > from flask import Flask, Request, Response > > You can try this? > > Cordialement, > Beugin Thomas > > > > 2010/11/18 LiChao <sockpuppet.lea@gmail.com>: > > Hi all: > > > > I met an error while importing the flask: > > Traceback (most recent call last): > > File "<stdin>", line 1, in ? > > File > > "/usr/lib/python2.4/site-packages/Flask-0.6-py2.4.egg/flask/__init__.py", > > line 18 > > from .app import Flask, Request, Response > > ^ > > SyntaxError: invalid syntax > > > > I gooled but no result, why this, please help. > > > > Here is the detail info: > > > > > > -bash-3.2$ cat /etc/issue > > CentOS release 5.5 (Final) > > Kernel \r on an \m > > > > > > -bash-3.2$ python > > Python 2.4.3 (#1, Nov 11 2010, 13:34:43) > > [GCC 4.1.2 20080704 (Red Hat 4.1.2-48)] on linux2 > > Type "help", "copyright", "credits" or "license" for more information. > >>>> import flask > > Traceback (most recent call last): > > File "<stdin>", line 1, in ? > > File > > "/usr/lib/python2.4/site-packages/Flask-0.6-py2.4.egg/flask/__init__.py", > > line 18 > > from .app import Flask, Request, Response > > ^ > > SyntaxError: invalid syntax > >>>> > > -bash-3.2$ > > > > > > BR > > 11/18/2010 > > > > > > >