Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Fatal Python error: initfsencoding: unable to load the file system codec
Good Day Everyone

I am very new to Python programming and created program to compare two csv files and produce a result in Excel. The program worked fine so i created a exe by using pyinstaller. Pyinstaller created the exe with some warning. However, when i am trying to run the exe( from dist folder), i am getting below error:

Fatal Python error: initfsencoding: unable to load the file system codec
zipimport.ZipImportError: can't find module 'encodings'

Below is my current Python Version:
Python 3.6.6 (v3.6.6:4cf1f54eb7, Jun 27 2018, 03:37:03) [MSC v.1900 64 bit (AMD64)] on win32

When i setup PYTHONHOME and PYTHONPATH in the environment variable then i am getting same when i am even trying to open python 3.6 command prompt( before setting up the path, i was able to open the python 3.6 command prompt)



Any help pointer/help would be highly appreciated!

Environment variables don't matter when running a bundled package, since they're not used. That's the whole point of using Pyinstaller, it tries to guess what modules you import, then it bundles those together to create something that can run without python or other modules installed.

But that also means that sometimes Pyinstaller misses a few modules while looking for what you use. Because that's a pretty common thing to happen while bundling, the docs cover it:
Hi Nilamo

Thank you so much for the response, i really appreciate the help!

I read the note and i can understand that encodings module is missing but still could not figure out how to include it. I also read about hidden module but could not understand how to include. Could you please guide me on how to include encodings module in my script. Do i need to pipinstall it and then use import statement in .py script?

Thanks again for your help!

How are you using it, if you're not already importing it somehow?
I am using below imports only so i am not sure why it is trying to import encodings module.

import pandas
import sqlite3
from tkinter import *
import tkinter
import tkinter.messagebox
import csv
from xlsxwriter.workbook import Workbook

Thanks Again!

I guess try it with the newest development version off github?
Hi Nilamo

I reviewed the notes and it talks about Python 3.6 resolves the issue but i am already on python 3.6 so not sure how to fix it?

Also when i try to run the exe from cmd prompt, i get below error:

File "benefitenrollmentcompare.exe", line 1
SyntaxError: Non-UTF-8 code starting with '\x90' in file benefitenrollmentcompare.exe on line 1, but no encoding declared; see for details.

I added below code but still getting the same error.

# -*- coding: utf-8 -*-

Any help/pointer would be highly appreciated!

(Nov-30-2018, 05:23 PM)gauravbhardwajee Wrote: but no encoding declared; see for details.
There is no need to declare encoding in Python 3.6 --> as utf-8 is default encoding.
Look at this thread,so when i test this out a always build virtual environment first(to make troubleshooting with pyinstaller easier if needed).
The you see after troubleshooting that this is needed to get pandas to work with pyinstaller.
You see i use same approach in Sound-player standalone.
There i use pipenv to build virtual environment,then build pyinstaller.
Hi Snippsat

Thank you so much for help, i really appreciate it!

I tried exact steps mentioned in payinstalled exe size but still getting same encondig error and also my exe size did not reduce( its 57MB).

I am writing my code in Notepad++, not sure if this is the issue.


Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  Error : (FileNotFoundError(2, 'The system cannot find the file specified', None, 2, Shipika 3 579 Nov-25-2019, 02:39 PM
Last Post: buran
  Fatal Python error: Aborted rohitlal125555 0 476 Nov-12-2019, 05:43 AM
Last Post: rohitlal125555
  (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \ Jack_Sparrow 5 94,898 Aug-17-2019, 04:29 PM
Last Post: CharlesT
  Unable to identify Tuple index error appmkl 4 1,127 Jun-28-2019, 10:12 AM
Last Post: appmkl
  Is there any way to properly load fixed width file into a dataframe using Pandas? vicky53 1 872 Mar-29-2019, 06:04 PM
Last Post: Larz60+
  Load .abf file and for analysis with Pandas finalcode 0 893 Nov-10-2018, 09:51 AM
Last Post: finalcode
  save 2d array to file and load back ian 3 8,343 May-18-2018, 05:00 AM
Last Post: scidam
  Newbie, can't load csv file. david_ford 2 3,592 Apr-15-2018, 01:51 PM
Last Post: snippsat
  Unable to create vtu file from python tady57 2 2,107 Dec-01-2017, 09:58 PM
Last Post: Larz60+
  Unable to understand reason for error IndexError: tuple index out of range rajat2504 4 46,400 Dec-09-2016, 11:04 AM
Last Post: Kebap

Forum Jump:

Users browsing this thread: 1 Guest(s)