pyinstaller created exe fails for python key error

24 views
Skip to first unread message

garr...@gmail.com

unread,
Nov 30, 2020, 2:54:35 AM11/30/20
to PyInstaller
I have created an exe from a python scrip, but when the exe is run it fails. The reason seems to be a key error in the python which does not happen when the python is run from the IDE in which it is created.

Here is the error when the exe is run:
C:\Users\Louise\Documents\XPGroundWorks\Release10\dist\xpgroundworks>xpgroundworks.exe
Traceback (most recent call last):
  File "XPGroundWorks.py", line 5094, in <module>
  File "XPGroundWorks.py", line 5083, in main
  File "XPGroundWorks.py", line 200, in __init__
KeyError: '7ZIP'
[11324] Failed to execute script XPGroundWorks

Here is the python code:
self.zip_app = self.text['7ZIP']

Here is the data used to create the key:
<data key="7ZIP" english="7zip location" dsp_text="C:\Program Files\7-Zip\7z.exe"
This is the path to the 7-ZIP file from windows explorer:
C:\Program Files\7-Zip

I don't know what else to show you.
The python works fine when run from the IDE, but fails with this key error when run from the exe.

Anyone have any ideas?

Louise.

bwoodsend

unread,
Nov 30, 2020, 10:11:54 AM11/30/20
to PyInstaller

That, on its own, is a very un-PyInstaller looking type of error. It’s more likely that either your built app is reading a different xml file or that you are filtering self.text in a way that depends on the existence of 7z.exe. Are you able to reduce it down to something that you can send us? It looks like your reading and xml then looking up an entry in it? Is self.text is the direct contents of the parsed xml? Can you at least share the snippet of Python code that opens/locates the xml? Also check that running Python from terminal works - python xpgroundworks.py - your IDE sandboxes things which can make PyInstaller look like the culprit when it isn’t.

Reply all
Reply to author
Forward
0 new messages