[PyQt] Still (apparently) having version issues

Phil Thompson phil at riverbankcomputing.com
Mon Aug 2 09:01:59 BST 2010


On Mon, 2 Aug 2010 08:34:01 +1000, Peter Milliken
<peter.milliken at gmail.com> wrote:
> I have Python 2.6.2 installed. I have installed PyQt-Py2.6-gpl-4.7.4-1.
I
> have also installed dip-p2-gpl-0.2-snapshot-6de9307b5575.
> 
> I am attempting the example on p9 of the dip documentation ("The
Smallest
> Example"). I have typed the code in (as opposed to downloading it) and
get
> the following error when I run it:
> 
> wres12386#1(~/Test)$ python test.py
> Traceback (most recent call last):
>   File "test.py", line 5, in <module>
>     from dip.ui import Form
>   File "c:\Python26\lib\site-packages\dip\__init__.py", line 34, in
>   <module>
>     raise ValueError("PyQt QString API v2 is required")
> ValueError: PyQt QString API v2 is required
> [exited with 1]
> 
> From this I assume I still have version issue incompatibilities? Could
> somebody point out which package I have wrong?
> 
> Thanks
> Peter
> 
> P.S. I have attempted running the same code from the dip distribution in
> doc/examples/ui/simple.py - after I correct the "app.exec()" (what has
> changed that all the code makes a method call that is not in the
> library???)
> line it gives exactly the same error message.

Looks like I forgot to port the examples to Python v2.

The version issue is explained here...

http://www.riverbankcomputing.com/static/Docs/PyQt4/pyqt4ref.html#selecting-incompatible-apis

So, for Python v2, you need the following before you import a PyQt
module...

import sip
sip.setapi('QString', 2)
sip.setapi('QVariant', 2)

You can also include them for Python v3 where they will just be ignored.

The dip-builder script generates the correct, portable, code.

Phil


More information about the PyQt mailing list