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

PYTHONHOME
C:\Users\gaurbhardwaj\AppData\Local\Programs\Python\Python37-32

PYTHONPATH
C:\Users\gaurbhardwaj\AppData\Local\Programs\Python\Python37-32\Lib\site-packages

Any help pointer/help would be highly appreciated!

Thanks
Gaurav
Quote
#2
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: https://pythonhosted.org/PyInstaller/ope...gram-needs
Quote
#3
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!

Thanks
Gaurav
Quote
#4
How are you using it, if you're not already importing it somehow?
Quote
#5
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!
Gaurav
Quote
#6
https://github.com/pyinstaller/pyinstaller/issues/3642

I guess try it with the newest development version off github?
Quote
#7
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?

Thanks
Gaurav
Quote
#8
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 http://python.org/dev/peps/pep-0263/ for details.

I added below code but still getting the same error.

#!/usr/local/bin/python
# -*- coding: utf-8 -*-


Any help/pointer would be highly appreciated!

Thanks
Gaurav
Quote
#9
(Nov-30-2018, 05:23 PM)gauravbhardwajee Wrote: but no encoding declared; see http://python.org/dev/peps/pep-0263/ 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.
hiddenimports=['pandas._libs.tslibs.timedeltas'],
You see i use same approach in Sound-player standalone.
There i use pipenv to build virtual environment,then build pyinstaller.
Quote
#10
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.

Thanks
Gaurav
Quote

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  Fatal Python error: Aborted rohitlal125555 0 76 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 59,056 Aug-17-2019, 04:29 PM
Last Post: CharlesT
  Unable to identify Tuple index error appmkl 4 489 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 471 Mar-29-2019, 06:04 PM
Last Post: Larz60+
  Load .abf file and for analysis with Pandas finalcode 0 595 Nov-10-2018, 09:51 AM
Last Post: finalcode
  save 2d array to file and load back ian 3 5,891 May-18-2018, 05:00 AM
Last Post: scidam
  Newbie, can't load csv file. david_ford 2 2,758 Apr-15-2018, 01:51 PM
Last Post: snippsat
  Unable to create vtu file from python tady57 2 1,695 Dec-01-2017, 09:58 PM
Last Post: Larz60+
  Unable to understand reason for error IndexError: tuple index out of range rajat2504 4 35,702 Dec-09-2016, 11:04 AM
Last Post: Kebap

Forum Jump:


Users browsing this thread: 1 Guest(s)