python - Why is pylint unable to find this package's module(s)? -


i'm working pylint, , i'm getting error when lint single file (repro below). i'm using azure sdk, package i'm referencing, shouldn't significant here.

repro

$ mkdir pylinttesting && cd pylinttesting $ python3 -m venv venv $ . venv/bin/activate $ pip3 install azure==2.0.0rc6 $ echo 'from azure import mgmt' > app.py 

running script file causes no issues (python3 app.py)

pylint output

even though totally valid , runs/imports without error, pylint still complains it. relevant output below (cut down brevity)...

e:  1, 0: no name 'mgmt' in module 'azure' (no-name-in-module)  external dependencies --------------------- ::      azure (app) 

but! if run little snippet (in same virtual environment)...

import os import pkgutil import azure  package_path = os.path.dirname(azure.__file__) [print(name) _, name, _ in pkgutil.iter_modules([package_path])] 

... following output...

batch common mgmt servicebus servicemanagement storage 

so mgmt module lives in azure package. i'm wondering why pylint doesn't pick up?

it's worth noting if from azure import common (common module in package), pylint doesn't throw error.

any thoughts on why pylint may unhappy mgmt module in package?

edit: pylint version information...

pylint 1.6.5,  astroid 1.4.9 python 3.6.0 (default, dec 24 2016, 00:01:50)  [gcc 4.2.1 compatible apple llvm 8.0.0 (clang-800.0.42.1)] 

you using pylint version not (yet) support declare_namespace creating namespaces. version of pylint/astroid used you?

see https://github.com/pycqa/pylint/issues/687 similar issue , link code supports namespace creation.

keep in mind pylint not run python code during analysis, of non-standard (non-inferable) constructs have supported writing custom code.


Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -