I'm compiling a command line application using PyInstaller 3.0 with python 3.5 on Windows.
When I run the application under CMD.EXE configured for code page 65001, the compiled executable will not run, with the message:
Fatal Python error: Py_Initialize: can't initialize sys standard streams
LookupError: unknown encoding: cp65001
If CMD.EXE is configured for it's default code page (437) the compiled executable will run with out problem.
What I already tried:
- I inserted the following code as the very first thing my application calls:
import codecs
codecs.register(lambda name: codecs.lookup('utf-8') if name == 'cp65001' else None)
Called 'chcp 65001' before compiling with PyInstaller, so the whole compilation is done under code page 65001
Ran cmd.exe in admin mode
These did not solve the problem.
System information:
- Windows 7 Enterprise, Service Pack 1
- Python 3.5
- PyInstaller 3.0
- The command I use to change the code page: chcp 65001