On 2015-02-12 17:45, Gisle Vanem wrote: > I tried using Interactive Python with a PyQt4 console: > "IPython.exe qtconsole" > > But got a > "ImportError: IPython requires PyQT4 >= 4.7, found 4.10.4" > > Looking at Ipython's check (in > site-packages\IPython\external\qt.py): if QtCore.PYQT_VERSION_STR < > '4.7': raise ImportError("IPython requires PyQt4 >= 4.7, found > %s"%QtCore.PYQT_VERSION_STR) > > So even if '4.10' < '4.7', my '4.10' is newer. What odd version > scheme is this really? I just edited that line to read: > if QtCore.PYQT_VERSION_STR < '4.10':'
This looks like it's comparing them as strings. It would be wiser if the program compared them as version-numbers: from distutils.version import LooseVersion, StrictVersion qt_ver = QtCore.PYQT_VERSION_STR target_ver = "4.10" for t, desc in [ (str, "String"), (LooseVersion, "Loose"), (StrictVersion, "Strict"), ]: a = t(qt_ver) b = t(target_ver) print("Using %s comparison, '%r < %r' is %s" % ( desc, qt_ver, target_ver, a < b) So the test should actually be something like if LooseVersion(QtCore.PYQT_VERSION_STR) < LooseVersion("4.10"): balk() -tkc -- https://mail.python.org/mailman/listinfo/python-list