[PyQt] pyuic4 strange behavior
Marco Fabiani
himork at kth.se
Tue Aug 26 10:30:31 BST 2008
Hello,
I am trying to generate some python code from a Qt Designer file with
pyuic4. In my GUI I have a custom widget written in python (see another
of my posts).
The code of the custom widget start with the usual "from PyQt4 import
QtCore, QtGui".
Now, if I run pyuic4 I get this error message:
---
Traceback (most recent call last):
File "/Library/Python/2.5/site-packages/PyQt4/uic/pyuic.py", line 73,
in <module>
options.indent, options.pyqt3_wrapper)
File "/Library/Python/2.5/site-packages/PyQt4/uic/pyuic.py", line 28,
in generateUi
uic.compileUi(uifname, pyfile, execute, indent, pyqt3_wrapper)
File "/Library/Python/2.5/site-packages/PyQt4/uic/__init__.py", line
66, in compileUi
winfo = compiler.UICompiler().compileUi(uifile, pyfile)
File
"/Library/Python/2.5/site-packages/PyQt4/uic/Compiler/compiler.py", line
15, in __init__
CompilerCreatorPolicy())
File "/Library/Python/2.5/site-packages/PyQt4/uic/uiparser.py", line
88, in __init__
self.factory = QObjectCreator(creatorPolicy)
File "/Library/Python/2.5/site-packages/PyQt4/uic/objcreator.py",
line 53, in __init__
raise WidgetPluginError, "%s: %s" % (e.__class__, str(e))
WidgetPluginError: <type 'exceptions.NameError'>: name 'QtCore' is not
defined
---
I tried to play around with the widget's file, and surprisingly if I
change the custom widget code to "from PyQt4 import xxx, QtGui" (where
xxx can be anything except QtCore) I manage to get my python code
generated, and it also appears to work...
Is that a bug?
More information about the PyQt
mailing list