From: Dr N. O'B. <no...@ca...> - 2006-06-19 20:58:29
|
On Jun 19 2006, Adam Tenderholt wrote: >> You could interrogate the Qt version, and do different things >> depending >> on the result, e.g.: >> >>>>> import qt >>>>> qt.qVersion() >> '3.3.4' >>>>> qt.qVersion().split(".") >> ['3', '3', '4'] >> >> qVersion mightn't be the right one, there are also the following: >>>>> [x for x in qt.__dict__.keys() if x.lower().find("version")>=0] >> ['PYQT_VERSION_STR', 'QT_VERSION', 'qVersion', 'QT_VERSION_STR', >> 'PYQT_VERSION'] > >The problem with this approach is that the module names have changed >from qt (Qt 2/3) to PyQt4 (Qt4), and if one is already loaded, it >complains when the one tries to load the other. Do you know of an >easy way to query the loaded modules, or is dir going to be the >easiest way? You can do this as follows: import sys 'cclib' in sys.modules.keys() # False import cclib 'cclib' in sys.modules.keys() # True But how are you going to use this in practice? What's wrong with a: try: import Qt4 except ImportError: try: import qt3 except ImportError: pass or something? >Adam > >P.S. Glad to see you working on the pylint stuff. :o) It's a bit of a drag, but it means that we'll be safe from the code police. They're everywhere now - sometimes I feel like I'm turning into one myself. :-) > > >_______________________________________________ >cclib-devel mailing list >ccl...@li... >https://lists.sourceforge.net/lists/listinfo/cclib-devel > |