[PyQt] How to fix "sip: Q_PID is undefined"?

Hans Meine meine at informatik.uni-hamburg.de
Fri Apr 4 12:40:48 BST 2008


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.)

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

Please tell me if I'm missing something and whether there is some experience 
with sip+qmake.

Thanks in advance,
Ciao, /  /
     /--/
    /  / ANS


More information about the PyQt mailing list