Reputation: 83706
I am trying to run pylint against source code polluted by Zope imports:
************* Module youraddon.interfaces
F0401: 11,0: Unable to import 'zope.interface'
The code in the question:
from zope.interface import Interface
And zope.interface egg is passed in sys.path for pylint as egg:
cat ../../bin/pylint|grep -i interface
'/fast/buildout-cache/eggs/zope.interface-3.6.7-py2.6-macosx-10.6-i386.egg',
Now the question is
Can I make pylint import zope.interface in a way it understands it? Why it actually fails?
If not, how can I supress import warnings and lint the rest of the file fine?
Also getting:
# E0611: 11,0: No name 'interface' in module 'zope'
Upvotes: 4
Views: 683
Reputation: 1914
I'd not install pylint globally but install it with the buildout you are installing your project with (assuming you are using buildout). You'd then add the instance eggs to the pylint part.
Something like this:
[buildout]
parts =
instance
pylint
[instance]
...
eggs =
your.addon
...
[pylint]
recipe = zc.recipe.egg
entry-points = pylint=pylint.lint:Run
eggs =
pylint
${instance:eggs}
A more complex example: https://github.com/4teamwork/ftw-buildouts/blob/master/test-base.cfg#L163
Cheers
Upvotes: 0
Reputation: 56
You can disable specific Pylint error message :
1) on the command line using --disable option
$ pylint --disable=F0401 youraddon.py
2) in the file adding a specific comment
#pylint: disable=F0401
http://www.logilab.org/card/pylint_manual
Upvotes: 1