[PyQt] Incorrect base for wrapped class

Kelly Burkhart kelly.burkhart at gmail.com
Wed Jul 4 14:31:35 BST 2007


On 7/3/07, Phil Thompson <phil at riverbankcomputing.co.uk> wrote:
> On Tuesday 03 July 2007 6:28 pm, Kelly Burkhart wrote:
<snip>
> > Built my class and see the same results.
>
> And it's Python bindings I assume. Are you sure you don't have another copy of
> the PyQt .sip files somewhere which are being picked up instead of the ones
> you've just installed.

I did a find in /usr and /opt for *.sip.  Aside from the correct sip
files which are in /usr/share/sip/PyQt4, the only other sip files I
see on my machine are in /opt/kde3/share/sip.

If I strace my sip command and grep for the opens, I see that sip is
opening the sip files in /usr/share/sip/PyQt4 (which all have a
timestamp of yesterday when I reinstalled).

>
> > If I change the base class of my c++ class, I get seemingly random
> > different bases when imported in python:
> >
> > QObject --> PyQt4.QtCore.QAbstractFileEngineHandler
> > QIODevice --> PyQt4.QtCore.QMimeData
> > QFile --> PyQt4.QtCore.QFileSystemWatcher
> >
> > Any other ideas?
>
> I'd then start to distrust your own Python bindings, but I would say that
> wouldn't I.
>
> A lot of the internals of a SIP generated module are table driven. The order
> in which things appear in tables is dependent on the .sip files. If the .sip
> files don't match then one module might be using the wrong table index.

I can't see anything wrong in my installation.  I've created a trivial
test extension and can run that on my home machine with different
linux version, different Qt version, different PyQt version and get
the same results.  If I'm installing something wrong, I'm at least
consistently installing wrong, and the only symptom is that I cannot
build a sip extension.

Would you mind downloading this?  <http://www.kkcsm.net/pqtext.tar.gz>

You should be able to modify the first few lines of the makefile
appropriately and do this:

$ export LD_LIBRARY_PATH=`pwd`
$ make
$ ./tst.py

When I run this I see my classes base to be <class
'PyQt4.QtCore.QFileSystemWatcher'> when I believe it should be QFile.
I'm hoping you'll be able to reproduce my failure, or show that
everything works well when properly installed.  (at which point I'll
be doomed).

Thank you,

-Kelly


More information about the PyQt mailing list