Skip to content

pylint pkgwhitelist working #3562

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
fschlatt opened this issue Dec 5, 2018 · 8 comments
Closed

pylint pkgwhitelist working #3562

fschlatt opened this issue Dec 5, 2018 · 8 comments
Assignees
Labels
info-needed Issue requires more information from poster

Comments

@fschlatt
Copy link

fschlatt commented Dec 5, 2018

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.

@brettcannon
Copy link
Member

Are you running pylint from an activated conda environment?

@brettcannon brettcannon added info-needed Issue requires more information from poster triage labels Dec 5, 2018
@brettcannon brettcannon self-assigned this Dec 5, 2018
@fschlatt
Copy link
Author

fschlatt commented Dec 6, 2018

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.

@brettcannon
Copy link
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.

@fschlatt
Copy link
Author

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

@brettcannon
Copy link
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.

@fschlatt
Copy link
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.

@brettcannon
Copy link
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.

@fschlatt
Copy link
Author

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

@lock lock bot locked as resolved and limited conversation to collaborators Jan 11, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
info-needed Issue requires more information from poster
Projects
None yet
Development

No branches or pull requests

2 participants