金字塔pserve.exe语法错误 [英] Pyramid pserve.exe syntax error

查看:40
本文介绍了金字塔pserve.exe语法错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 pcreate 创建了一个金字塔应用程序,现在当我尝试使用带有 --reload 的 pserve 运行它时,出现以下错误

 语法错误:第 1 行文件 <path>\pserve.exe 中的非 ASCII 字符 '\x90',但未声明编码;有关详细信息,请参阅 http://python.org/dev/peps/pep-0263/

有趣的是,此错误仅在我使用 --reload 时出现,如果我删除 reload,它会正常启动.

调试后,我在 pserve.exe 的同一位置看到另一个文件 pserve-script.py 并且这个 python 脚本是由 pserve.exe 内部调用的(我不明白为什么?当 pserve 本身是可执行的)

上面的 pserve-script.py 有以下内容,我认为上面的错误是因为跟随 shebang.

#!c:\<文件夹路径>\Scripts\python.exe# EASY-INSTALL-ENTRY-SCRIPT: 'pyramid','console_scripts','pserve'__requires__ = '金字塔'进口重新导入系统从 pkg_resources 导入 load_entry_point如果 __name__ == '__main__':sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])系统退出(load_entry_point('金字塔', 'console_scripts', 'pserve')())

解决方案

这是pserve 重新加载器在低于 1.8 的 Pyramid 版本中编写的方式的问题,据我所知,我们(Pyramid 开发人员)还没有弄清楚发生这种情况的原因.

在 Pyramid 1.8(刚刚发布了 alpha 版本)中,我们转而使用 hupper,它在 Windows 下应该能更好地工作.

请使用以下方式安装:

pip install pyramid==1.8a1

然后看看问题是否消失!

I have created a pyramid application using pcreate, now when I try to run it using pserve with --reload, I get following error

 SyntaxError: Non-ASCII character '\x90' in file <path>\pserve.exe on line 1, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details

Interestingly this error shows up only when I use --reload, if I remove reload it starts fine.

After debugging, I see another file pserve-script.py at the same location of pserve.exe and this python script is internally called by pserve.exe ( I don't understand why? when pserve itself is executable)

The above pserve-script.py has following content and I assume the above error is because of following shebang.

#!c:\<folder-path>\Scripts\python.exe
# EASY-INSTALL-ENTRY-SCRIPT: 'pyramid','console_scripts','pserve'
__requires__ = 'pyramid'
import re
import sys
from pkg_resources import load_entry_point

if __name__ == '__main__':
    sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
    sys.exit(
        load_entry_point('pyramid', 'console_scripts', 'pserve')()
    )

解决方案

This is an issue with the way the pserve reloader is written in Pyramid versions less than 1.8, as far as I know, we (Pyramid developers) haven't figured out a reason why this happens.

In Pyramid 1.8 (which just had an alpha version released) we moved to using hupper which should work much better under Windows.

Please install it using:

pip install pyramid==1.8a1

And see if the issue disappears!

这篇关于金字塔pserve.exe语法错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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