Question: How can i solve no-ascii character error executing pserve on virtualenv in windows?
Description: I'm trying to execute pserve (pyllons/pyramid development web server) inside a virtualenv on windows. It's a fresh install, so maybe it is related to versions.
Problem: With the virtualenv activated, execute pserve config.ini
throw error: SyntaxError: Non-ASCII character '\x90' in file C:\PATH_TO_MY_ENV_HOME\env\Scripts\pserve.exe on line 1, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details
.
Command line:
pserve development.ini --reload
Notes:
- this error happen when you have a file with characters that doesn't match the current file encoding, so you can add a instruction to set the right enconde at the beging of the python script.
- it can happen if the called target have an exe extension in some cases and the script that call it add an exe to the end. So, python runtime throws this error cause an exe file must not be called as an script, but just called without sufix adding.
- The path to executable does't contains special characters.
Tests done:
- Remove exe extension from pserve. Didn't worked: not recognized command message.
- Call pserve-script.py instead pserve (full path tried too). Didn't worked: do nothing and returns nothing.
- Added "-*- encoding: utf-8" at the start of pserve-script.py. Same message.
- Remove exe extenstion from python.exe (full path tried too). Didn't worked: "failed to create process".
Environment:
- Windows 10 1607 build 14393.447
- Python version: Anaconda2, Python 2.7.11
- Pyramid version: pyramid 1.7.3
- Virtual env: 15.1.0
SOLUTION:
Uninstall and install again solved the problem to me.