Search code examples
pythonvisual-studio-codepylint

Pylint not showing ouput in VSCode


I'm trying to check for issues in a script I'm working on "python_record.py". If I run pylint python_record.py in a terminal I get a long output with multiple errors.

But when I run pylint through VSCode I don't get anything. I've enabled linting, and selected run pylint and it's giving me nothing. The following is my settings.json:

{
    "terminal.integrated.shell.windows": "C:\\WINDOWS\\System32\\wsl.exe",
    "git.confirmSync": false,
    "python.linting.enabled": true,
    "window.zoomLevel": -2,
    "python.pythonPath": "C:\\Users\\becky\\AppData\\Local\\Programs\\Python\\Python38- 
      32\\python.exe",
    "files.autoSave": "off",
    "terminal.integrated.automationShell.linux": "",
    "python.linting.pylintEnabled": true,
    "python.linting.pylintUseMinimalCheckers": false,
    "terminal.integrated.env.linux": {
    },
    "terminal.integrated.automationShell.windows": "",
    "python.autoComplete.extraPaths": [
    ],
    "workbench.editorAssociations": [
    {
        "viewType": "jupyter.notebook.ipynb",
        "filenamePattern": "*.ipynb"
    }
]

}

VSCOde settings.json

I'm not fixed on any particularly fancy settings so happy to change the settings.json around completely, I just want my default terminal to be bash and linting to run properly (particularly on save).

Please let me know if you can help!

Thanks!!

Edit:

If I run pip show pylint in my VSCode terminal, the following is returned: enter image description here


Solution

  • For anyone else struggling with this, I resolved it by reinstalling VSCode and starting from scratch as follows:

    1. Uninstalled VSCode
    2. Deleted my "User/AppData/Roaming/Code" folder
    3. Deleted my "User/[uname]/.vscode
    4. re-installed VSCode, it was completely fresh with none of my old settings/ scripts open.
    5. Installed VSCode extras that I needed (Python, WSL and Pylint extensions)
    6. ran pip install pylint in my terminal
    7. ran pylint --generate-rcfile | Out-File -Encoding utf8 .pylintrc in my terminal from the folder where my scripts are (not sure if I'll have to do this every time!)
    8. Restarted VSCode and it worked fine!

    (The locations of the folders you need to delete may be different I had to dig about a bit for mine. I also couldn't see them in my usual file explorer so I had to go through the command line - I use a bash emulator)

    This website was helpful: