[PyKDE] Using pyqt4 with py2app trunk

Matthew Scott mscott at springfieldtech.com
Thu Aug 31 18:55:54 BST 2006

(This is cross-posted from the pythonmac-sig mailing list)

I'm getting acquainted with PyQt4 lately, to build a GPL'd app intended
to be used at least on OSX and Linux.

I ran into this problem when trying to use py2app r44 from
http://svn.pythonmac.org/py2app/py2app/trunk :


Specifically, 'AttributeError: "qt_lib_dir" is not a valid configuration
value or user option'

This is definitely not the best thing to merge into py2app itself, but
to kickstart a renewed discussion, here's the patch I applied to it in
order to get a successful app build.  Any assistance or ideas on how to
generalize this in a way that could be folded into the py2app trunk are

Index: py2app/recipes/sip.py
--- py2app/recipes/sip.py       (revision 44)
+++ py2app/recipes/sip.py       (working copy)
@@ -13,8 +13,15 @@
           except NameError:
               from sets import Set as set

-        cfg = sipconfig.Configuration()
+        # XXX: PyQt4 hack.
+        # Original:
+        ## cfg = sipconfig.Configuration()
+        ## qtdir = cfg.qt_lib_dir
+        # Modified:
+        from PyQt4 import pyqtconfig
+        cfg = pyqtconfig.Configuration()
           qtdir = cfg.qt_lib_dir
+        # /XXX
           if not os.path.exists(qtdir):
               # half-broken installation?  ignore.
               raise ImportError

Relevant system info:

   OSX 10.4.7 build 8J2135
   Intel Core Duo processor

Universal framework build of Python:
   Python 2.4.3 (#1, Apr  7 2006, 10:54:33)
   [GCC 4.0.1 (Apple Computer, Inc. build 5250)] on darwin

Qt4 and PyQt4 (both GPL editions):
   >>>from PyQt4 import QtCore

Matthew Scott
mscott at springfieldtech.com

More information about the PyQt mailing list