[PyQt] Moving PyQt programs to Python 3
Algis Kabaila
akabaila at pcug.org.au
Fri Jul 15 07:48:54 BST 2011
On Fri, 15 Jul 2011 12:35:48 PM Mike Ramirez wrote:
> On Friday 15 July 2011 11:42:59 Algis Kabaila wrote:
> > If I get binaries for PyQt I can ascertain the version of PyQt and Qt
> > itself, but AFAIK there is no way of ascertaining which breed of python,
> > 2.x or 3.x, PyQt is bound to. IMHO it would be useful to have
> > PYTHON_VERSION_STR, just like the PYQT_VERSION_STR for identification
> > purposes. Without it there will occasionally be confusion of matching
> > Python version with the right PyQt version, whilst we are in a 2 to 3
> > transition state.
>
> How's this? I'm assuming you want a string version of both...
>
> from PyQt4.Qt import PYQT_VERSION_STR
> import sys
>
> print("PyQt: {0}\nPython: {1}".format(PYQT_VERSION_STR, sys.version))
>
> You're trying to figure out if pyqt is built for 2.6/2.7/3.1/3.2... it
> should exist in that python versions lib/python${VERSION}/site-packages
> directory (or for windows Python${VERSION}/Lib/site-packages), unless
> you're making a boo- boo manually setting your PYTHONPATH so one package
> lib affects all versions.... I would suggest only setting up PYTHONPATH
> for libraries and apps you're working on, static libs should go in the
> site-packages directory for this specific reason.
>
> Mike
>
Mike,
Thank you for your suggestion. Yes, the location of PyQt package on the
machine should tell me what version the package is, provided that the packager
has put it in the "right place" ("right place" = where we think it should be
:)
Currently reputable distros such as ubuntu do not package binaries of PyQt
with Python3. There are other "unsupported binaries" in some ppa's (Personal
Packaging Archives).. The ones that I looked at do not bother to tell me what
version of Python they are bound to - I assume it is 2.x.
Also, when I do ask "how do I find out what Python version this PyQt binary is
bound to", the real question is "how does someone satisfy a helper on this
list that the PyQt binary she/he is using is bound to Python 3.x". How else
hers/his questions can be answered without suspicion of mismatch of binaries
for PyQt and Python version being seen as the probable reason why "her/his"
code works on helpers PC and not his/hers?
At the moment, that is not a very important question, as most users (probably)
still use python 2.x, but IMO the serious movement to Python 3.x is beginning
to take place. So it would be good to be prepared for the stampede.
I am sorry for the noise on this list.. It is the price developers have pay
for accepting users in a developers' list, with appologies from this user.
OldAl..
More information about the PyQt
mailing list