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.

pylint not executed in multi-root workspace

See original GitHub issue

Environment data

  • VS Code version: 1.32.3
  • Extension version (available under the Extensions sidebar): 2019.2.5558
  • OS and version: Windows_NT x64 10.0.16299
  • Python version (& distribution if applicable, e.g. Anaconda): 3.7.2
  • Type of virtual environment used (N/A | venv | virtualenv | conda | …): N/A
  • Relevant/affected Python packages and their versions: pylint 2.1.1

Expected behaviour

When running the linters with pylint enabled, pylint should be executed and results should be shown. In the Output tab under Python, the linting output should be shown.

This is what happens when the folder is opened outside the multi-root workspace. Note that pep8 is also configured and shown in the log:

##########Linting Output - pep8##########
4,15,E,E225:missing whitespace around operator
##########Linting Output - pylint##########
************* Module test
test.py:4:0: C0325: Unnecessary parens after 'if' keyword (superfluous-parens)
test.py:4:12: C0326: Exactly one space required after comparison
if(__name__ =='__main__'):
            ^^ (bad-whitespace)
test.py:1:0: C0111: Missing module docstring (missing-docstring)
test.py:1:0: C0111: Missing function docstring (missing-docstring)

Actual behaviour

Pylint is not executed. Only pep8 is in the output:

##########Linting Output - pep8##########
4,15,E,E225:missing whitespace around operator

Additionally, a notification is shown: Linter pylint is installed but not enabled.. However, pylint is enabled in the folder’s (not the workspaces) settings.json

Steps to reproduce:

  1. Open two empty folders in one workspace
  2. –see the notification that pylint is disabled–
  3. Click “Enable”
  4. –see that .vscode/settings.json is created in the first folder–
  5. Copy the created file to the second folder to have pylint explicitly activated there as well
  6. Optionally enable pep8 as a reference
  7. Create a python file in both folders that have some errors. The following should be enough to trigger both pylint and pep8:
def main():
    pass

if(__name__ =='__main__'):
    main()
  1. Run linting on either of the files (e.g. through the explicit command)
  2. –notice pylint does not show up in the Output Panel, but pep8 does–
  3. Open either of the folders in its own window and see in the Output that pylint is executed

Logs

Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

see above

Output from Console under the Developer Tools panel (toggle Developer Tools on under Help; turn on source maps to make any tracebacks be useful by running Enable source map support for extension debugging)

[Extension Host] Python Extension: Cached data exists getEnvironmentVariables, c:\Users\liwde\dev\one\test.py

Other

I noticed there recently was some work on tests in multi-root workspaces (https://github.com/Microsoft/vscode-python/issues/4268). I don’t know if there is any connection, but as I experienced this issue in the same project as well, I thought it might be worth mentioning here. Also maybe relevant here: https://github.com/Microsoft/vscode-python/issues/862

Please let me know if you need more information to reproduce this! Thank you very much!

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:5
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
brettcannoncommented, Jul 24, 2020

We are going through old issues and we noticed that no one from the team had replied to this issue. I want to apologize for the oversight and to let you know that the issue was reviewed by the team and triaged (as shown by the labels applied to this issue).

0reactions
karthiknadigcommented, Nov 8, 2022

Please try the https://marketplace.visualstudio.com/items?itemName=ms-python.pylint extension. It should support multi-root, and multi-python scenarios. We are migrating users to the new extension. Closing this issue, since this should be handled by the new extension.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Setting python.path for VS Code Python Debugger for Multi ...
I have a multi-root workspace with three directories in VS Code. I source a different virtual environment when I need to run scripts...
Read more >
Splitting python code into multiple services inside of a single ...
After some trial and I error I was able to get it to work by using a .code-workspace file to define a “multi-root...
Read more >
Linting Python in Visual Studio Code
The linter has not been installed in the current Python environment. Open a command prompt, navigate to the location where your selecter interpreter...
Read more >
Pylance Now Default Language Server for Python in Visual ...
No such language server is more important to VS Coders than Pylance, ... Native multi-root workspace support; IntelliCode compatibility ...
Read more >
Announcing Pylance: Fast, feature-rich language support for ...
Pylance natively supports multi-root workspaces, meaning that you can open ... If you are not already using the Python extension in VS Code, ......
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