Results 1 to 4 of 4

Thread: PyQt4 to Py3exe problem

  1. #1
    Join Date
    Jun 2007
    Posts
    62
    Thanks
    28
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Unhappy PyQt4 to Py3exe problem

    I have a simplistic "hello world" program using PyQt4 GPL ("test.py").
    It runs fine when invoked from Python.

    I make an executable utilizing Py2exe.
    But when I try running the executable, it gives the following error:

    Qt Code:
    1. Traceback (most recent call last):
    2. File "test.py", line 2, in <module>
    3. File "PyQt4\QtCore.pyc", line 12, in <module>
    4. File "PyQt4\QtCore.pyc", line 10, in __load
    5. ImportError: No module named _qt
    To copy to clipboard, switch view to plain text mode 

    I'm sure I'm making a simplistic amateur mistake somewhere.

    I am using Window XP personal edition,
    Python 2.5,
    PyQt v4 GPL for Windows and Python v2.5
    (PyQt-Py2.5-gpl-4.3.0-b1.exe),
    Sip 4.7,
    and Py2Exe 0.6.6
    (py2exe-0.6.6.win32-py2.5.exe)

    My Py2Exe setup script is:
    Qt Code:
    1. from distutils.core import setup
    2. import py2exe
    3.  
    4. setup(windows=[{"script":"test.py"}], options={"py2exe":{"includes":["sip"]}})
    To copy to clipboard, switch view to plain text mode 

    My application consists of two modules, the main is in
    test.py, the rest is in test_ui.py

    I invoke Py2Exe with the following line in the Windows Command Prompt:
    Qt Code:
    1. c:\Python25\python setup.py py2exe
    To copy to clipboard, switch view to plain text mode 
    when in the directory containing test.py

    In the Py2Exe script, I've tried replacing "sip" with "PyQt4",
    which seems to have no effect.

    Neither does changing the Py2exe setup script to
    Qt Code:
    1. setup(console=['test.py'])
    To copy to clipboard, switch view to plain text mode 
    and invoking it with
    Qt Code:
    1. c:\Python25\python setup.py py2exe --include sip
    To copy to clipboard, switch view to plain text mode 
    Does anybody have any idea what I am doing wrong?

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: PyQt4 to Py3exe problem

    Maybe per analogiam to this your should try:

    setup(windows=[{"script":"test.py"}], options={"py2exe":{"includes":["sip", "_qt"]}})

  3. #3
    Join Date
    Jun 2007
    Posts
    62
    Thanks
    28
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: PyQt4 to Py2exe problem

    Quote Originally Posted by jacek View Post
    Maybe per analogiam to this your should try:

    setup(windows=[{"script":"test.py"}], options={"py2exe":{"includes":["sip", "_qt"]}})
    Yes, I had tried that. Py2Exe complains that it cannot find _qt.
    I guess nobody here uses PyQt4 with Py2exe. Or it is a trade secret.

  4. #4

    Default Re: PyQt4 to Py3exe problem

    Try this:

    from distutils.core import setup
    import py2exe
    setup(
    windows = [{"script": "test.py"}],
    options = {"py2exe":{"includes":["sip", "PyQt4._qt"]}}
    )

Similar Threads

  1. Replies: 16
    Last Post: 7th March 2006, 15:57

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.