Chrugel
Chrugel

Reputation: 893

cx_freeze pyqt4 example ("\samples\PyQt4") doesn't work

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:

Problem:

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

Answers (1)

Chrugel
Chrugel

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

Related Questions