1

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:

  1. 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)

  1. Called 'chcp 65001' before compiling with PyInstaller, so the whole compilation is done under code page 65001

  2. 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
Periodic Maintenance
  • 1,698
  • 4
  • 20
  • 32

1 Answers1

1

Appears to be a bug in PyInstaller-3.0. I opened an issue on their gihub page. I will update here if any work around is found.

Periodic Maintenance
  • 1,698
  • 4
  • 20
  • 32