[PyQt] PyQt 4.4-snapshot-20080507: Running webbrowser.py

Aaron Digulla digulla at hepe.com
Fri May 9 10:28:00 BST 2008


Phil Thompson schrieb:
> On Thursday 08 May 2008 21:08:42 Aaron Digulla wrote:
>> When I run python examples/activeqt/webbrowser/webbrowser.py, I get this
>> error with the latest snapshot:
>>
>> Traceback (most recent call last):
>>   File "examples/activeqt/webbrowser/webbrowser.py", line 22, in <module>
>>     from PyQt4 import QtCore, QtGui, QAxContainer
>> ImportError: cannot import name QAxContainer
>>
>> Is this a bug in the snapshot or on my system?
> 
> It's only available with the commercial version.

Here is a fix. Replace the line

from PyQt4 import QtCore, QtGui, QAxContainer

with

from PyQt4 import QtCore, QtGui
try:
    from PyQt4 import QAxContainer
except:
    raise Exception("QAxContainer couldn't be imported. This class is
only available on Windows and in the Desktop Editor, *not* the Qt Open
Source Edition!")

(don't forget to join the broken line :)

Regards,

-- 
Aaron "Optimizer" Digulla a.k.a. Philmann Dark
"It's not the universe that's limited, it's our imagination.
Follow me and I'll show you something beyond the limits."
http://darkviews.blogspot.com/          http://www.pdark.de/


More information about the PyQt mailing list