I have been playing with Python recently on several different
platforms (Win Vista & 7, Ubuntu 12.04/12.10, running either regular
Python, python(x,y) or Portable Python, using either Spyder or PyDev
as editor) 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.
In other examples where the code first imports from PyQt4.QtCore, then
from PyQt4.QtGui, I get the same error. But if I reverse the imports
i.e. import PyQt4.QtGui first... the error goes away.
Here is a sample of the error message I get as part of pylint output
with the imports in the original order (but not with them reveresed):
No config file found, using default configuration
Traceback (most recent call last):
File
"/usr/lib/python2.7/dist-
packages/logilab/astng/scoped_nodes.py", line
284, in getattr
return [self.import_module(name, relative_only=True)]
File
"/usr/lib/python2.7/dist-packages/logilab/astng/scoped_nodes.py", line
339, in import_module
return MANAGER.astng_from_module_name(absmodname)
File "/usr/lib/python2.7/dist-packages/logilab/astng/manager.py",
line 135, in astng_from_module_name
return self.astng_from_module(module, modname)
File "/usr/lib/python2.7/dist-packages/logilab/astng/manager.py",
line 190, in astng_from_module
return ASTNGBuilder(self).module_build(module, modname)
File "/usr/lib/python2.7/dist-packages/logilab/astng/builder.py",
line 105, in module_build
node = self.inspect_build(module, modname=modname, path=path)
File
"/usr/lib/python2.7/dist-packages/logilab/astng/raw_building.py", line
222, in inspect_build
self.object_build(node, module)
File
"/usr/lib/python2.7/dist-packages/logilab/astng/raw_building.py", line
261, in object_build
class_node = object_build_class(node, member, name)
File
"/usr/lib/python2.7/dist-packages/logilab/astng/raw_building.py", line
136, in object_build_class
basenames = [base.__name__ for base in member.__bases__]
TypeError: C++ type 'QWidget*' is not supported as type
************* Module currency
...
At first I thought it was just a spyder problem, as I don't get that
kind of error in pydev, but the more I mess around with it, I think
that the pydev version of pylint may not be working 100%, as I get the
same errors running pylint manually as I do within spyder.
So... at this point I can 'fix' things by swapping the import order on
every single source file I open from the book code repositories... but
since pylint is throwing an error on code that actually works... I
thought it might be worth bringing it here to see if something else
can/should be done about it.
TIA,
Monte
_______________________________________________
Python-Projects mailing list
[email protected]
http://lists.logilab.org/mailman/listinfo/python-projects