"No module named" errors with prospector - pylint
See original GitHub issueEnvironment data
- VS Code version: 1.22.2
- Extension version (available under the Extensions sidebar): 2018.3.1
- OS and version: OSX 10.13.4
- Python version (& distribution if applicable, e.g. Anaconda): 3.6.5
- Type of virtual environment used (N/A | venv | virtualenv | conda | …): pipenv
- Relevant/affected Python packages and their versions: n/a
Actual behavior
All python files in project show this error in addition to normal pylint errors (if there are any): [prospector - pylint] fatal:No module named Users/aaa/bbb/ccc/models.py
The path is correct for the file, except for the lack of a leading ‘/’
Looks like the path is getting mangled (see the logs below). Let me know if there’s anything else I can help with in tracking this issue down.
Expected behavior
No error
Steps to reproduce:
- Create environment in pipenv
- Create
__init__.py
file and create models.py file with some python code in them - Add folder to VS Code
Logs
Output for Python
in the Output
panel (View
→Output
, change the drop-down the upper-right of the Output
panel to Python
)
##########Linting Output - prospector##########
{
"summary": {
"started": "2018-04-19 14:36:19.127187",
"libraries": [],
"strictness": null,
"profiles": "default, no_doc_warnings, no_test_warnings, strictness_medium, strictness_high, strictness_veryhigh, no_member_warnings",
"tools": [
"dodgy",
"mccabe",
"pep8",
"profile-validator",
"pyflakes",
"pylint"
],
"message_count": 2,
"completed": "2018-04-19 14:36:19.299807",
"time_taken": "0.17",
"formatter": "json"
},
"messages": [
{
"source": "pylint",
"code": "unused-import",
"location": {
"path": "/Users/aaa/bbb/ccc/models.py",
"module": "models",
"function": null,
"line": 1,
"character": 0
},
"message": "Unused models imported from django.db"
},
{
"source": "pylint",
"code": "fatal",
"location": {
"path": "/Users/aaa/bbb/Users/aaa/bbb/ccc/models.py",
"module": "/Users/aaa/bbb/Users/aaa/bbb/ccc/models.py",
"function": null,
"line": 1,
"character": 0
},
"message": "No module named Users/aaa/bbb/ccc/models.py"
}
]
}
Output from Console
under the Developer Tools
panel (toggle Developer Tools on under Help
)
None
Issue Analytics
- State:
- Created 5 years ago
- Comments:9 (2 by maintainers)
Top Results From Across the Web
PyLint "Unable to import" error - how to set PYTHONPATH?
There are two options I'm aware of. One, change the PYTHONPATH environment variable to include the directory above your module.
Read more >2. Command Line Usage — prospector documentation
Often tools such as pylint find errors in code which is not an error, due to attributes of classes being created at run...
Read more >ModuleNotFoundError: no module named Python Error ...
How to fix the ModuleNotFoundError in Python · 1. Make sure imported modules are installed · 2. Make sure modules are spelled correctly...
Read more >Pylint's ChangeLog — Pylint 2.12.2 documentation
Added support for ModuleNotFoundError ( import-error and no-name-in-module ). ModuleNotFoundError inherits from ImportError and was added in ...
Read more >Linting Python in Visual Studio Code
Linting highlights syntactical and stylistic problems in your Python source code, which often helps you identify and correct subtle programming errors or ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
New
prospector
version released. Please update your environment 😃This is an issue in prospector, which has already been fixed but it’s missing a pypi release. I recently tagged the version with the fix and it should be released on pypi soon.