Reputation: 893
My System:
Windows 7, x64, Python 3.3.1, PyQt4 4.10 using Installer (py3.3-Qt5.0.1-x64), cx_freeze 4.3.1 (win-amd64-py3.3)
What worked:
Navigating in Terminal to the ..python33\lib\site-packages\cx_freeze\samples
folder (and into the respective example-folder) and execute python setup.py build
This worked with: \simple
and \tkinter
(just to make sure I didn't went wrong somewhere else)
Problem:
But my goal is to get a executable file/package of my PyQt4-Project, so I tried the same with the \PyQt4
example (btw. the PyQt4app.py works perfectly as python application)
\PyQt4 >>> python setup.py build
doesn't work initially: Running the generated PyQt4app.exe
results in an error, asking for the missing package "re"
Subsequently I am including "re" in the setup.py
file. (options = {"build_exe" : {"includes" : ["atexit", "re"]}}
)
Now it generates an .exe without throwing an error - BUT running this .exe doesn't do anything, just silence...
cx_freeze seems to find the correct dependencies: python33.dll
, Qt5Core.dll
, Qt5Gui.dll
, PyQt4.QtCore.pyd
, PyQt4.QtGui.pyd
(among others: sip, unicodedata, etc) are present.
Here the setup.py
(unaltered, except "re" included & comments removed)
import sys
from cx_Freeze import setup, Executable
base = None
if sys.platform == "win32":
base = "Win32GUI"
setup(
name = "simple_PyQt4",
version = "0.1",
description = "Sample cx_Freeze PyQt4 script",
options = {"build_exe" : {"includes" : ["atexit", "re"]}},
executables = [Executable("PyQt4app.py", base = base)])
Any suggestions where I am going wrong? What additional information would be useful?
edit: I managed to get the console-output by setting base = None
and running the .exe via a batch file. The Output is: Failed to load platform plugin "windows". Available platforms are:
(end of output - there is no list or anything).
So where and how to get this plugin loaded?
Upvotes: 4
Views: 5243
Reputation: 893
Ok - I found a workaround:
Copy the qwindows.dll
WITH its folder \platforms\qwindow.dll
from ..\python33\lib\site-packages\PyQt4\plugins
into the folder where the .exe is. Now it works.
edit:
My setup.py
looks now like this, and seems to be applicable to other cases as well:
import sys
from cx_Freeze import setup, Executable
base = "Win32GUI"
path_platforms = ( "..\..\..\PyQt4\plugins\platforms\qwindows.dll", "platforms\qwindows.dll" )
build_options = {"includes" : [ "re", "atexit" ], "include_files" : [ path_platforms ]}
setup(
name = "simple_PyQt4",
version = "0.1",
description = "Sample cx_Freeze PyQt4 script",
options = {"build_exe" : build_options},
executables = [Executable("PyQt4app.py", base = base)]
)
Upvotes: 4