Fatal Python error when trying to run an executable Python script
I have a Python script that I turned into an executable using cx-freeze-4.3.4.win32-py3.4
. I have it Python 3.4
installed on my machine Windows 7 64-bit
.
Here is my simple setup.py file:
from cx_Freeze import setup, Executable
setup( name = "myfilename" ,
version = "0.1" ,
description = "This is my file" ,
executables = [Executable("myfilename.py")] , )
I ran python setup.py build
from the command line in a folder C:\Python34
using the script I was trying to convert and a setup.py file. This created another folder called build
inside, there was another folder named exe.win32-3.4
. In this folder, I found my executable, a bunch of files .pyd
, one file, .dll
and a zipped archive named library
from a group of files .pyc
.
If I run the executable from exe.win32-3.4
with the zip archive it does fine. However, without a library archive of .pyc files (basically if I just try to run the .exe itself, which is what I should be doing), the executable throws this error:
Fatal Python error: cannot get zipimpirter instance
Current thread 0x000001b48 (most recet call first):
I did a preliminary web search for possible solutions to this problem, but could not find anything substantive. If anyone knows how to fix this issue that would be much appreciated.
source to share
From docs :
Single file executables
cx_Freeze does not support creating a single exe file where all the libraries for your application are built into a single executable.
For a single file solution using py2exe and others see this question .
There is also a new zipapp module in 3.5 , although basic functionality has been around for a while.
source to share