Search code examples
pythonpython-3.xcx-freeze

What could be the reason for fatal python error:initfsencoding:unable to load the file system codec?


I am using Python 3.7 (64-bit) and installed cx_Freeze for converting .py into .exe.

I used this command prompt to convert Python script into an executable:

python [filename] build

It successfully build the executable. But when I executed my EXE file, I just get output:

fatal python error:initfsencoding:unable to load the file system codec
ImportError: invalid flags 1530052318 in 'encoding'
Current thread 0X000013f8 :

How to solve it and successfully make an executable file using cx_Freeze?


Solution

  • Fixed in 4c18633. The problem is that for version x64 for Python 3.7 it is not working due to class config for freezer.py. You need to go cx_Freezer installation folder. If you have a virtual environment, go to your environment folder \lib\site-packages\cx_Freeze, find the freezer.py and add the code found on the commit.

    You can find the patch at GitHub