[PyQt] ImportError: No module named QtOpenGL

Phil Thompson phil at riverbankcomputing.co.uk
Tue May 1 08:23:53 BST 2007


On Monday 30 April 2007 10:29 pm, Danny Pansters wrote:
> On Monday 30 April 2007 14:50:29 Giovanni Bajo wrote:
> > On 30/04/2007 9.11, Mark Summerfield wrote:
> > > But I agree with the general point that using "import *" is reasonable
> > > when you have a large library like PyQt4---providing that library has
> > > sensible export behaviour. For example, I _assume_ that the PyQt4
> > > libraries will only export things with names matching /Q[A-Z]\w+/ and
> > > would expect anything that didn't have such a name either not to be
> > > exported or to have a special prefix such as "qt" to avoid unpleasant
> > > surprises.
> >
> > Well, I had always assumed this as well, but it looks like we were both
> > wrong
> >
> > :) The QTextStream non member functions
> >
> > (http://doc.trolltech.com/4.2/qtextstream.html#related-non-members) are
> > not qualified in any way, and, worse, there are two named "hex" and
> > "oct".
> >
> > Anyway, not that I care specifically: I'm going to prod the trolls about
> > this issue (it's really unconvenient in C++ as well).
>
> <prodded troll>
> Well, the main dislike about the "consolidated" module for me is that
> unless it contains all pyqt4 modules it can never be clear which ones are
> really present on a given box. It will depend on packaging (by 3rd
> parties), or even worse packaging or source building by 3rd parties where
> the modules are split up or are build-time settings. So it will be a very
> unportable thing to use. For that reason alone its use should be
> discouraged. Namespace clashes are second to that IMHO.
>
> Needless to say that my py-qt4-* ports for FreeBSD (yes, split up) don't
> provide the consolidated module. Once you split the modules into seperate
> packages, managing a consolidated module is a package-list nightmare. It
> can be touched/changed by any of the py-qt4-* packages that are installed
> or updated afterwards. Another reason to not use the metamodule :)
> </prodded troll>
>
> IMHO,

Then, IMHO, your package is broken. The consolidated module is a documented 
component of PyQt and should be present and importing it should always work. 
However, what it actually imports depends on what other modules are 
installed.

It's not as if it is difficult to fix. Just modify Qt.py to import the 
optional groups of classes in a try/except.

Phil


More information about the PyQt mailing list