gpt4 book ai didi

由于粘贴,Pyramid mongodb 脚手架在 Python 3 上失败

转载 作者:行者123 更新时间:2023-12-01 23:13:59 27 4
gpt4 key购买 nike

环境:

  • Python 3.2.3(使用 virtualenv)
  • Pyramid 1.4
  • pyramid_mongodb 脚手架

在使用 pyramid_mongodb 脚手架安装我的项目后,我运行了 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 不兼容。我也知道如何修复它,但这实际上意味着将 Paste 移植到 python3(这是我不想做的事情),所以谁能告诉我我能做什么?

从错误堆栈中我看到 webob/exc.py 正在执行 from paste import httpexceptions 但是当我检查代码时我看到导入是在 try except block (不会在 except 中引发任何错误),所以我什至在从 paste 中删除后尝试了测试lib 但是当我运行测试时,我看到 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 文件与 this 相同谁能告诉我这个 paste 依赖项在哪里进入我的项目。

最佳答案

我不打算回答我自己的问题,但由于我做了对我有用的更改,我想我会在这里分享它(假设会有其他人想要在 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很重要

应用程序正在运行...

关于由于粘贴,Pyramid mongodb 脚手架在 Python 3 上失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16312788/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com