由于粘贴,Pyramid mongodb 脚手架在 Python 3 上失败 [英] Pyramid mongodb scaffold failing on Python 3 due to Paste

查看:27
本文介绍了由于粘贴,Pyramid mongodb 脚手架在 Python 3 上失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

环境:

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

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

After installing myproject using pyramid_mongodb scaffold I ran python setup.py test -q and it's failing with below errors.

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(这是我不想做的事情),所以有人能告诉我我能做什么吗?

I understand the error, that Paste is not python3 compatible. I also know how to fix it but that would essentially mean porting Paste to python3 (which is something I don't want to do), so can anyone tell what I can do?

从错误堆栈中,我看到 webob/exc.py 正在执行 from paste import httpexceptions 但是当我检查代码时,我看到导入位于 try except 块(在 except 中没有引发任何错误),所以我什至在从lib 但是当我运行测试时,我看到 setup.py 再次安装 paste

From the error stack I see that webob/exc.py is doing from paste import httpexceptions but when I checked the code I see that the import is under a try except block (without raising any error in except), so I even tried the test after removing paste from the lib but then when I run the test, I see that the setup.py is installing paste again

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

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

I checked .pth files and removed reference to paste and then started re-installation of project but somehow it still sees paste as required

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 依赖项在哪里进入我的项目.

My setup.py file is same as this Can someone tell me where is this paste dependency coming into my project.

推荐答案

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

I didn't intend to answer my own question but since I have made changes which are working for me, I thought I will share it here (assuming that there would be other folks wanting to have pyramid_mongodb scaffold work on python3)

发展变化.ini

已删除

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

改变了

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

已添加(可选)

pyramid.includes =
    pyramid_debugtoolbar

更换服务器(从粘贴到服务员)

Changed server (from paste to waitress)

[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 很重要

It's important to remove webError

应用程序正在运行...

The application is now working...

这篇关于由于粘贴,Pyramid mongodb 脚手架在 Python 3 上失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆