[PyQt] PyQt4 import module fails second time when running python from Qt-C++ based shell
jackcosgrove at gmail.com
Fri May 6 06:05:19 BST 2011
I've attached a small Qt project for a Python shell. It also uses
QScintilla. It's amazing that I made this in about 5 minutes, thanks
The problem I'm encountering is that I can only correctly import a PyQt4
module once using this shell. If I try to import again then I cannot use
classes within the module. The code
from PyQt4 import QtCore
succeeds the first time it is run. The second time it complains that
"AttributeError: 'module' object has no attribute 'QObject'". This does
not happen with other modules like sys. The Python execution code uses
all temporary variables.
At first I thought this was because of a flaw in my C++ code, but the
success of loading a non-Qt-based modules piqued my curiosity. Has
anyone ever seen something like this?
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 1941 bytes
Desc: not available
More information about the PyQt