c3cris
c3cris

Reputation: 1326

Pylint is reporting false-positive error

error   zb1.buildup     1   0   Unable to import 'application'

Here is the screenshot of my structure. It's screaming about all my imports from my current project. Does it not add the project as a path?

I know pylint is a static code checker but this feels obviously wrong. Let me know if I made a mistake of on my part. Thank you!

P.S. Just in case here is the pylint command pylint --output-format=html ../zb1 > pylint.html . Also code works, just in case you are wondering.

buildup.py

from application import app, db #import app

if __name__ == "__main__":
    db.create_all()

Screenshot

$ pylint --version
No config file found, using default configuration
pylint 1.6.4,
astroid 1.4.7
Python 3.5.2 (default, Jun 29 2016, 13:43:58)
[GCC 4.2.1 Compatible Apple LLVM 7.3.0 (clang-703.0.31)]

Upvotes: 1

Views: 1691

Answers (1)

John Percival Hackworth
John Percival Hackworth

Reputation: 11531

You're having an issue with the python search path. A relatively simple solution is to define the PYTHONPATH environment variable. Assuming that you're trying to invoke pylint from within zb1, the following should work:

PYTHONPATH=`pwd` pylint --output-format=html ../zb1 > pylint.html

The addition at the beginning of the line defined the PYTHONPATH environment variable for that invocation of pylint.

Upvotes: 1

Related Questions