[PyQt] How to fix "sip: Q_PID is undefined"?
Phil Thompson
phil at riverbankcomputing.com
Fri Apr 4 13:10:55 BST 2008
On Friday 04 April 2008, Hans Meine wrote:
> Hi,
>
> I am trying to create Python bindings for my VigraQt library, which - among
> others - contains a Qt-based image viewer (see
> http://kogs-www.informatik.uni-hamburg.de/~meine/software/vigraqt/). In
> the past, I have used autotools as a build system, and it was a big hassle
> to get sip integrated. Most notably, automake seems to require the list of
> sources files to be known, which is not really the case before sip is
> called (e.g. depending on the Sip/PyQt version, I had a moc file appear and
> disappear again). Now, I have ported VigraQt to Qt4, and I am looking at
> whether using a purely qmake-based build system is easier.
>
> Right now, my question is why I get the above error ("sip: Q_PID is
> undefined"). I found an older posting in which Phil states "You need to
> set the correct -t flags on the sip command line. If you use the build
> system this is done for you.". However, it is not clear to me what he
> means with "the build system"? (Please see below how I call sip.)
The build system is the sipconfig and pyqtconfig modules that you are using.
They will generate Makefiles for you - there is no need to use qmake. The
Python bindings in QScintilla2 (and the sip documentation) is probably the
best thing to look at.
> Also, I would like to know whether there are examples (projects etc.) I
> could refer to how to integrate a sip-generated python binding in a
> qmake-based build system?
>
> In order to do so, I figured it would be easiest to write a small python
>
> script that I'll call from QMake's project file:
> | import PyQt4.pyqtconfig, subprocess
> |
> | config = PyQt4.pyqtconfig.Configuration()
> |
> | command = [config.sip_bin,
> | config.pyqt_sip_flags,
> | "-I", config.pyqt_sip_dir,
> | "VigraQtmod.sip"]
> | print " ".join(command)
> | subprocess.call(command)
>
> This leads to the following invocation of sip which fails with the above
> error:
>
> /software/python-sip-4.5.2/SuSE-10.2_qt4/bin/sip -x VendorID -t WS_X11 -x
> PyQt_NoPrintRangeBug -t Qt_4_2_2 -I
> /software/python-qt-4.1.1/share/sip/PyQt4 VigraQtmod.sip
Q_PID should be defined as you are passing "-t WS_X11" - see qprocess.sip. So
the problem isn't just setting the correct -t flags.
> Please tell me if I'm missing something and whether there is some
> experience with sip+qmake.
Phil
More information about the PyQt
mailing list