Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pylint can't find QtCore in PyQt4

I recently installed Python(x,y) for spyder and the PyQt4 support. I selected pylint during the install process, and loaded up a script from the code resources for 'Rapid GUI Development with Python & Qt4'... specifically the first simple 'alert.pyw' from chapter 4.

Pylint is saying that this is an error:

from PyQt4.QtCore import (QTime, QTimer, Qt, SIGNAL)

...and here is the error message:

[E0611]19: No name 'QtCore' in module 'PyQt4'

...but in both the regular Python interpreter (2.7.3) and the ipython interpreter (0.13) I can type in:

from PyQt<tab>4.QtC<tab>ore

and the auto-complete seems to find it just fine.

Is there some way to get pylint set up so it sees things that are obviously there, or am I better off disabling pylint and going back to pyflakes or something else?

like image 636
memilanuk Avatar asked Nov 12 '22 16:11

memilanuk


1 Answers

This looks like it may be related to the pylint issue raised here, although it is from quite some time ago. What versions of PyQt4 and pylint are you using?

If it is the same issue, then changing the imports to something like:

from PyQt4 import QtGui
from PyQt4.QtCore import (QTime, QTimer, Qt, SIGNAL)

may stop the "error" messages.

like image 192
ekhumoro Avatar answered Nov 15 '22 06:11

ekhumoro