Non-ASCII character '\\x90' executing pserve on windows inside virtualenv

拟墨画扇 提交于 2019-12-03 13:18:05
RichVel

I don't really have an answer here as I don't use either Pyramid or Windows. However, this has been seen before by a few people and may be due to python.exe being used to execute pserve.exe, which won't work as that's an executable not a Python program.

Here are some links that might move this forward - recommend you join the Google Group as it has more concentrated Pyramid expertise:

One specific idea is to ensure you have a pserve.py file not pserve.exe and that you use python pserve.py to run it. If the calling script has limitations, create a run-pserve.bat batch file to call Python and test it outside the calling script.

Alternatively, you might want to use a pre-configured Linux VM on Windows. Or on Windows 10 there is a good 'Bash for Windows' aka Windows Subsystem for Linux that's really a full Ubuntu Linux. Either of these would make it much easy for development than Windows, I would think.

Assuming your virtualenv sits in venv directory

Use this:

python venv/Lib/site-packages/pyramid/scripts/pserve.py some-ini-config.ini --reload

This error message comes with a suggestion and it reads

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

The bold part is where the suggestion is. This PEP is very straight forward and the solution is just to define an encoding for your source file. You will most likely to have

#!/usr/bin/env python
# coding=utf-8

The interpreter line is optional, but the coding can be defined second if you have interpreter line or first if you dont

Set the encoding depending on your character sets. utf-8 should work for most cases, or you may need other encodings.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!