On Thu, Oct 21, 2010 at 02:45:38PM +0200, Stanislav Ochotnicky wrote: > On 10/20/2010 04:11 PM, Rex Dieter wrote: > > Stanislav Ochotnicky wrote: > > > >> On 10/20/2010 02:38 PM, Neal Becker wrote: > >>> Has anyone attempted a pyqt for python3? > >> > >> I did. It failed (not on Fedora though and I didn't investigate at the > >> time). I seem to remember some symbol problems with QString class that > >> was reported when I tried to import PyQt from python3 interpreter. > > > > python3-PyQt4 should work (theoretically), but has seen very little real- > > world use or testing yet. Please file bugs. > > FYI I found solution to the problem I was encountering when using PyQt4 > with Python 3.x. > > PyQt 4.6+ uses new API for QString and QVariant when run on Python 3.x. > That has to do with unicode string being default in Python 3.x. > > Therefore you can replace all occurrences of QString with ordinary > python strings. > > For my use-case I wanted to have the same code for Python 2.x/3.x so I > did this: > > try: > from PyQt4.QtCore import QString > except ImportError: > # we are using Python3 so QString is not defined > QString = type("") > Thanks for sharing this! I've added a page on python.org's wiki for porting tips for python3 and pyqt: http://wiki.python.org/moin/PortingPythonToPy3k/PyQt4 Feel free to add or correct information there. I'm not certain if it still does but in the past the python wiki allowed anonymous edits if you don't want to make an account. -Toshio
Attachment:
pgp1_yHZpCaEP.pgp
Description: PGP signature
-- devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxxx https://admin.fedoraproject.org/mailman/listinfo/devel