4

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?

Chrugel
  • 883
  • 2
  • 11
  • 19
  • The `re` problem should be fixed by [this pull request](https://bitbucket.org/anthony_tuininga/cx_freeze/pull-request/18/ensure-re-module-is-copied-on-python-3). – Thomas K May 03 '13 at 11:52

1 Answers1

4

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)]
    )
Chrugel
  • 883
  • 2
  • 11
  • 19
  • It looks like platform plugins are new with Qt 5. I've filed an issue to handle them automatically: https://bitbucket.org/anthony_tuininga/cx_freeze/issue/33/handle-qt-5-platform-plugins – Thomas K May 03 '13 at 12:04