Skip to content

Troubleshooting Linting

Don Jayamanne edited this page Jun 22, 2016 · 8 revisions

Troubleshooting Linting

1. Unable to import (pylint)

  • Scenario: You have a module installed, however the linter in the IDE is complaining about not being able to import the module, hence you have error messages being displayed.
  • Cause: The Python extension is most likely using the wrong version of Pylint.

Solution 1: (configure workspace settings to point to fully qualified python executable):

  1. Open the workspace settings (settings.json)
  2. Identify the fully qualified path to the python executable (this could even be a virtual environment)
  3. Ensure Pylint is installed for the above python environment
  4. Configure the setting "pythonPath" to point to (previously identified) fully qualified python executable.
"python.pythonPath": "/users/xxx/bin/python"

Solution 2: (open VS Code from an activated virtual environment):

  1. Open the terminal window
  2. Activate the relevant python virtual environment
  3. Ensure Pylint is installed within this virtual environment pip install pylint
  4. Close all instances of VS Code
  5. Launch VS Code from within this terminal window
    (this will ensure the VS Code process will inherit all of the Virtual Env environment settings)
Clone this wiki locally