Pylint doesn't like pkg_resources.resource_filename

In my script, I use:

python from pkg_resources import resource_filename

Both PyDev and pylint 0.23 complain about unresolved imports here.

E0611 No name 'resource_filename' in module 'pkg_resources'

As I understand it, this is due to the fact that PyDev and pylint only perform source code analysis, not trying to parse and compile it. And, apparently, pkg_resourcesdoes something special to determine pkg_resources. There is, of course, a package and a symbol, and all this works great. Two questions:

  • How can I convince both Eclipse and PyDev that they are wrong?
  • What causes the problem in the first place? I have not found other people having such a problem, and I doubt that my situation is somewhat unique ... :)

Python 2.7.1 (under OSX), distribute 0.6.19.

+5
2

, pydev python. , . / .

python (preferences => pydev => interpreters => python interpreter) pydev. Forced Builtins. New... pkg_resources .

, , . python 2.7.9, pydev 3.3.3 eclipse kepler r2.

pylint pylint , . # pylint: disable=E1101 , , , , . , , , .

+6

. pydev.org: , ctrl-1 "undefined variable". #@UndefinedVariable, .

pylint, E1101 , # pylint: disable=E1101. Pylint , pydev . :

def get_test_datafile(file_):
    # pylint: disable=E1101
    return pkg_resources.resource_string(__name__, #@UndefinedVariable
                                         'testdata/'+file_)
+3

All Articles