Hello,

I came across the following problem with pylint: a import from a local directory works only if there's some `from ... import ...` statement above.
My code is organized as follows:

~/pylinttest/
foo/
        bar.py
        baz.py
        qux.py
        __init__.py
    .pylintrc

bar.py contains the following code:
from urllib import request
import qux

baz.py contains the following code:
import qux

Here are the results of running pylint:
alexey@ev9d9:~/pylinttest$ pylint foo.bar
Using config file /home/alexey/pylinttest/.pylintrc
************* Module foo.bar
W:  1, 0: Unused request imported from urllib (unused-import)
W:  2, 0: Unused import qux (unused-import)
alexey@ev9d9:~/pylinttest$ pylint foo.baz
Using config file /home/alexey/pylinttest/.pylintrc
************* Module foo.baz
E:  1, 0: Unable to import 'qux' (import-error)
W:  1, 0: Unused import qux (unused-import)

Why does it fail to load qux only if there was no from-import statement before? Changing urllib.request to e.g. collections.deque does not make a difference.

My pylint version is 1.1.0, and it can be reproduced both with python 2.7.5 and 3.4.0

Regards,
  Alexey
_______________________________________________
code-quality mailing list
code-quality@python.org
https://mail.python.org/mailman/listinfo/code-quality

Reply via email to