3

环境:

  • Python 3.2.3(使用 virtualenv)
  • 金字塔 1.4
  • pyramid_mongodb 脚手架

在使用 pyramid_mongodb 脚手架安装 myproject 后,我​​运行python setup.py test -q它并失败并出现以下错误。

running build_ext
Traceback (most recent call last):
  File "setup.py", line 33, in <module>
    """,
  File "/usr/lib/python3.2/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/usr/lib/python3.2/distutils/dist.py", line 917, in run_commands
    self.run_command(cmd)
  File "/usr/lib/python3.2/distutils/dist.py", line 936, in run_command
    cmd_obj.run()
  File "/root/App/Big3/lib/python3.2/site-packages/distribute-0.6.24-py3.2.egg/setuptools    /command/test.py", line 137, in run
    self.with_project_on_sys_path(self.run_tests)
  File "/root/App/Big3/lib/python3.2/site-packages/distribute-0.6.24-py3.2.egg/setuptools    /command/test.py", line 117, in with_project_on_sys_path
    func()
  File "/root/App/Big3/lib/python3.2/site-packages/distribute-0.6.24-py3.2.egg/setuptools    /command/test.py", line 146, in run_tests
    testLoader = loader_class()
  File "/usr/lib/python3.2/unittest/main.py", line 123, in __init__
    self.parseArgs(argv)
  File "/usr/lib/python3.2/unittest/main.py", line 191, in parseArgs
    self.createTests()
  File "/usr/lib/python3.2/unittest/main.py", line 198, in createTests
    self.module)
  File "/usr/lib/python3.2/unittest/loader.py", line 132, in loadTestsFromNames
    suites = [self.loadTestsFromName(name, module) for name in names]
  File "/usr/lib/python3.2/unittest/loader.py", line 132, in <listcomp>
    suites = [self.loadTestsFromName(name, module) for name in names]
  File "/usr/lib/python3.2/unittest/loader.py", line 91, in loadTestsFromName
    module = __import__('.'.join(parts_copy))
  File "/root/App/Big3/Lime/lime/__init__.py", line 1, in <module>
    from pyramid.config import Configurator
  File "/root/App/Big3/lib/python3.2/site-packages/pyramid-1.4.1-py3.2.egg/pyramid/config    /__init__.py", line 10, in <module>
    from webob.exc import WSGIHTTPException as WebobWSGIHTTPException
  File "/root/App/Big3/lib/python3.2/site-packages/WebOb-1.2.3-py3.2.egg/webob/exc.py",         line 1115, in <module>
    from paste import httpexceptions
  File "/root/App/Big3/lib/python3.2/site-packages/Paste-1.7.5.1-py3.2.egg/paste                /httpexceptions.py", line 634
        except HTTPException, exc:
                        ^
    SyntaxError: invalid syntax

我理解错误,粘贴不兼容 python3。我也知道如何解决它,但这基本上意味着将粘贴移植到 python3(这是我不想做的事情),所以谁能告诉我能做什么?

从错误堆栈中我看到这webob/exc.py是在做from paste import httpexceptions ,但是当我检查代码时,我看到导入在一个try except块下(没有在 中引发任何错误except),所以我什至在删除之后尝试了测试pastelib但是当我运行测试时,我看到 setup.py 正在paste再次安装

running test
Checking .pth file support in .
/root/App/Big3/bin/python -E -c pass
Searching for Paste>=1.7.1

我检查了 .pth 文件并删除了对项目的引用paste,然后开始重新安装项目,但不知何故它仍然认为paste是需要的

Installed /root/App/Big3/Myproject
Processing dependencies for Myproject==0.0
Searching for Paste>=1.7.1
Reading http://pypi.python.org/simple/Paste/

我的 setup.py 文件与此相同 有人可以告诉我这个paste依赖项在哪里进入我的项目。

4

1 回答 1

7

我不打算回答我自己的问题,但由于我做了对我有用的更改,我想我会在这里分享它(假设会有其他人想要在 python3 上使用 pyramid_mongodb 脚手架)

发展变化。初始化

已移除

[pipeline:main]
pipeline =
    egg:WebError#evalerror
    {{project}}

改变了

[app:{{project}}] to [app:main]

添加(可选)

pyramid.includes =
    pyramid_debugtoolbar

更改服务器(从粘贴到女服务员)

[server:main]
use = egg:waitress#main
host = 0.0.0.0
port = 6543

Setup.py 中的 更改需要从

requires = ['pyramid', 'WebError', 'pymongo']

requires = ['pyramid', 'pyramid_debugtoolbar', 'pymongo', 'uwsgi', 'waitress']

删除 webError 很重要

该应用程序现在正在运行...

于 2013-05-02T15:42:34.830 回答