[PyQt] BUG: Qwt widgets in uic files

Phil Thompson phil at riverbankcomputing.com
Mon Jan 24 15:06:48 GMT 2011


On Mon, 24 Jan 2011 15:35:30 +0100, Arne Schmitz <arne.schmitz at gmx.net>
wrote:
> Hello pyqt community!
> 
> Please find attached a small test program that fails on my PyQt
> installation. I am using py26-pyqt4 @4.8.2 from MacPorts with a Python
> 2.6.6 interpreter from MacPorts on OS X 10.6.6. When loading a uic file
in
> PyQt, I get the following error:
> 
> === Cut here ===
> Traceback (most recent call last):
>   File "./pyqt-qwt-test.py", line 14, in <module>
>     mainWindow = MyMainWindow()
>   File "./pyqt-qwt-test.py", line 11, in __init__
>     self.ui = uic.loadUi("MainWindow.ui", self)
>   File
>  
"/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/PyQt4/uic/__init__.py",
>   line 185, in loadUi
>     return DynamicUILoader().loadUi(uifile, baseinstance)
>   File
>  
"/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/PyQt4/uic/Loader/loader.py",
>   line 35, in loadUi
>     return self.parse(filename, basedir)
>   File
>  
"/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/PyQt4/uic/uiparser.py",
>   line 839, in parse
>     actor(elem)
>   File
>  
"/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/PyQt4/uic/uiparser.py",
>   line 686, in createUserInterface
>     self.traverseWidgetTree(elem)
>   File
>  
"/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/PyQt4/uic/uiparser.py",
>   line 664, in traverseWidgetTree
>     handler(self, child)
>   File
>  
"/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/PyQt4/uic/uiparser.py",
>   line 178, in createWidget
>     self.traverseWidgetTree(elem)
>   File
>  
"/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/PyQt4/uic/uiparser.py",
>   line 664, in traverseWidgetTree
>     handler(self, child)
>   File
>  
"/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/PyQt4/uic/uiparser.py",
>   line 406, in createLayout
>     self.traverseWidgetTree(elem)
>   File
>  
"/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/PyQt4/uic/uiparser.py",
>   line 664, in traverseWidgetTree
>     handler(self, child)
>   File
>  
"/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/PyQt4/uic/uiparser.py",
>   line 443, in handleItem
>     self.traverseWidgetTree(elem)
>   File
>  
"/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/PyQt4/uic/uiparser.py",
>   line 664, in traverseWidgetTree
>     handler(self, child)
>   File
>  
"/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/PyQt4/uic/uiparser.py",
>   line 172, in createWidget
>     self.stack.push(self.setupObject(widget_class, parent, elem))
>   File
>  
"/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/PyQt4/uic/uiparser.py",
>   line 140, in setupObject
>     obj =  self.factory.createQObject(clsname, name, args, is_attribute)
>   File
>  
"/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/PyQt4/uic/objcreator.py",
>   line 69, in createQObject
>     classType = self.findQObjectType(classname)
>   File
>  
"/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/PyQt4/uic/objcreator.py",
>   line 79, in findQObjectType
>     w = module.search(classname)
>   File
>  
"/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/PyQt4/uic/Loader/qobjectcreator.py",
>   line 30, in search
>     self._module = __import__(self._moduleName, {}, {}, self._classes)
> TypeError: 'set' object does not support indexing
> === Cut here ===
> 
> Best regards,
> 
> Arne Schmitz

I suspect that that is a problem with the Qwt module being imported.
Otherwise can you reproduce the problem without the dependency on an
external module?

Phil


More information about the PyQt mailing list