环境:
使用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
我理解错误,即Paste不兼容python3。我也知道如何修复它,但这本质上意味着将粘贴移植到python3(这是我不想做的事情),所以有人能告诉我能做什么吗?
从错误堆栈中我看到webob/exc.py
正在执行from paste import httpexceptions
但是当我检查代码时,我发现导入位于try
except
块下(没有提升) except
)中的任何错误,所以我甚至在从paste
删除lib
后尝试了测试但是当我运行测试时,我看到setup.py正在安装{{1再次
paste
我检查了.pth文件并删除了对running test
Checking .pth file support in .
/root/App/Big3/bin/python -E -c pass
Searching for Paste>=1.7.1
的引用,然后开始重新安装项目,但不知何故它仍然会根据需要看到paste
paste
我的setup.py文件与this相同
有人能告诉我这个Installed /root/App/Big3/Myproject
Processing dependencies for Myproject==0.0
Searching for Paste>=1.7.1
Reading http://pypi.python.org/simple/Paste/
依赖项会进入我的项目。
答案 0 :(得分:7)
我不打算回答我自己的问题,但由于我做了一些对我有用的改动,我想我会在这里分享一下(假设有其他人想在python3上运行pyramid_mongodb脚手架)< / p>
发展变化。 INI 强>
删除
[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非常重要
该应用程序正在运行......