question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"No module named" errors with prospector - pylint

See original GitHub issue

Environment 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:

  1. Create environment in pipenv
  2. Create __init__.py file and create models.py file with some python code in them
  3. Add folder to VS Code

Logs

Output for Python in the Output panel (ViewOutput, 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:closed
  • Created 5 years ago
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
chocoelhocommented, May 25, 2018

New prospector version released. Please update your environment 😃

2reactions
chocoelhocommented, May 23, 2018

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found