运行贴纸时语法错误?

时间:2011-07-18 05:51:59

标签: python syntax pyramid paster

不知道发生了什么,但突然之间,paster停止在我的服务器上工作(使用virtualenv和金字塔)。尝试重新安装一切,但没有工作 - 再次出现相同的错误:

Traceback (most recent call last):
  File "bin/paster", line 7, in ?
    sys.exit(
  File "/home/user/webapps/myapp/htdocs/lib/python2.4/site-packages/PasteScript-1.7.3-py2.4.egg/paste/script/command.py", line 83, in run
    command = commands[command_name].load()
  File "/home/user/webapps/myapp/htdocs/lib/python2.4/site-packages/setuptools-0.6c11-py2.4.egg/pkg_resources.py", line 1954, in load
    entry = __import__(self.module_name, globals(),globals(), ['__name__'])
  File "/home/user/webapps/myapp/htdocs/lib/python2.4/site-packages/PasteScript-1.7.3-py2.4.egg/paste/script/serve.py", line 19, in ?
     from paste.deploy import loadapp, loadserver
  File "/home/user/webapps/myapp/htdocs/lib/python2.4/site-packages/PasteDeploy-1.5.0-py2.4.egg/paste/deploy/__init__.py", line 3, in ?
    from paste.deploy.loadwsgi import *
  File "/home/user/webapps/myapp/htdocs/lib/python2.4/site-packages/PasteDeploy-1.5.0-py2.4.egg/paste/deploy/loadwsgi.py", line 393
    with open(filename) as f:
            ^
SyntaxError: invalid syntax

我发生了什么事?

1 个答案:

答案 0 :(得分:3)

您使用的是Python 2.4。它没有with语句。它只出现在Python 2.5中。

更新您的Python版本。