Tuesday, November 24, 2009

PyQt4 bug preventing it from working properly in Pydev (and workaround)

Hi All,

There have been some reports on people with problems to get PyQt4 working properly in Pydev... This is because depending on the version of PyQt4 it has a major bug that will crash a Python interpreter (this was confirmed in version 4.5.4 -- haven't checked on other versions).

To know if you have a version with this problem you can check it by running the code below in an interactive session:

>>> from PyQt4.QtCore import *
>>> QSignalMapper

>>> import inspect
>>> inspect.ismodule(QSignalMapper) <-- this will make the interpreter
crash!

If that's your problem, right now you have to fix Pydev by editing

eclipse/plugins/org.python.pydev/PySrc/importsTipper.py at line 154,
changing:
"for d in dirComps:"

to:

for d in dirComps:
    if d == 'QSignalMapper':
        continue

Or get another PyQt4 version.

No comments: