Skip to content

pylint pkgwhitelist working #3562

Closed
Closed

Description

Environment data

  • VS Code version: 1.29.1
  • Extension version (available under the Extensions sidebar): 2018.11.0
  • OS and version: Windows 10 Pro, Build 17134
  • Python version (& distribution if applicable, e.g. Anaconda): Python 3.7.0 Anaconda 4.5.11
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): N/A + conda
  • Relevant/affected Python packages and their versions: pylint 2.2.2

Expected behaviour

When calling pylint test.py --extension-pkg-whitelist=cv2 with test.py looking like so:

import cv2

cv2.imshow()

I obtain the output:

************* Module test
test.py:3:0: C0304: Final newline missing (missing-final-newline)
test.py:1:0: C0111: Missing module docstring (missing-docstring)

Actual behaviour

Trying the same in vscode with settings.json as:

{
    "python.linting.pylintArgs": ["--extension-pkg-whitelist=cv2"]
}

yields in the Python Output:

##########Linting Output - pylint##########
************* Module test
3,0,convention,C0304:Final newline missing
1,0,convention,C0111:Missing module docstring
3,0,error,E1101:Module 'cv2' has no 'imshow' member

Strangely, when changing settings.json to:

{
    "python.linting.pylintArgs": ["--version"]
}

the output is

##########Linting Output - pylint##########
__main__.py 2.2.2
astroid 2.0.4
Python 3.7.0 (default, Jun 28 2018, 08:04:48) [MSC v.1912 64 bit (AMD64)]

The developer console doesn't seem to give any helpful output.

To fix this I've tried completely a complete reinstall of vscode (including removing all extensions and clearing the cache), as well as using the base conda and a complete fresh conda environment. The last thing that would come to mind is an issue with Anaconda, but I'd like to refrain from a fresh Anaconda install if possible.

EDIT: Also holds for torch, so it is not just a cv2 module specific problem but an issue for any dynamically loaded (is this the correct term?) module.

EDIT 2: Didn't have access to my desktop the last couple of days, but now that I do have access, I am unable to reproduce the issue there. Linting works perfectly fine for both cv2 and torch.

Activity

  1. brettcannon commented on Dec 5, 2018

    @brettcannon
    Member

    Are you running pylint from an activated conda environment?

  2. fschlatt commented on Dec 6, 2018

    @fschlatt
    Author

    Yes, both in vscode and in the terminal. I've tried the base conda environment and also a new fresh conda environment. No other python installations are installed on the system. which pylint shows /cygdrive/c/Users/fschlatt/Anaconda3/Scripts/pylint. I've also tried removing cygwin from my path, but that also didn't have any effect.

  3. brettcannon commented on Dec 11, 2018

    @brettcannon
    Member

    Ah, you're using cygwin. We don't actually support cygwin so that's probably what's causing the issue. I take it your desktop isn't using cygwin when it worked there?

    Since we don't support cygwin I'm going to close this issue. If this comes up on a supported platform again then please let me know and I can re-open the issue.

  4. fschlatt commented on Dec 11, 2018

    @fschlatt
    Author

    Actually, I do have cygwin running on my desktop as well. Also, removing cygwin from the path completely removes any effects it has.

  5. brettcannon commented on Dec 11, 2018

    @brettcannon
    Member

    Are you using conda on both machines? And when you are testing from the command-line are you using the same Pylint you specified in "python.lintings.pylintPath" or by using python -m pylint to make sure it's the same one the extension is using? This issue is usually because of either version differences or packages are installed in a different environment than the one Pylint picks up.

  6. fschlatt commented on Dec 12, 2018

    @fschlatt
    Author

    As far as I can tell the configurations (conda, conda environments, cygwin, vscode, etc..) are identical between both machines. At least I try to keep them identical. Specifying the path explicitly as "python.linting.pylintPath": "C:/Users/fschlatt/Anaconda3/Scripts/pylint" didn't yield any different results. Also, both pylint --extension-pkg-whitelist=cv2 test.py as well as python -m pylint --extension-pkg-whitelist=cv2 test.py work as expected. The strange thing is that all other arguments like -h and --version work fine in vscode, just --extension-pkg-whitelist seems to create problems.

  7. brettcannon commented on Dec 12, 2018

    @brettcannon
    Member

    I'm going to assume it's an odd Pylint issue or a hard-to-diagnose environment issue then since we don't filter arguments to Pylint so this wouldn't be caused by us explicitly.

    One other option is to try using a .pylintrc file instead of command-line flag to see if that changes things for some reason.

  8. fschlatt commented on Dec 13, 2018

    @fschlatt
    Author

    Ok, I'll update the issue if a find a solution.

  9. locked as resolved and limited conversation to collaborators on Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

info-neededIssue requires more information from poster

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions