Repository navigation
pylint pkgwhitelist working #3562
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
brettcannon commentedon Dec 5, 2018
Are you running
pylintfrom an activated conda environment?fschlatt commentedon 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 pylintshows/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 commentedon Dec 11, 2018
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 commentedon Dec 11, 2018
Actually, I do have cygwin running on my desktop as well. Also, removing cygwin from the path completely removes any effects it has.
brettcannon commentedon Dec 11, 2018
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 usingpython -m pylintto 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 commentedon Dec 12, 2018
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, bothpylint --extension-pkg-whitelist=cv2 test.pyas well aspython -m pylint --extension-pkg-whitelist=cv2 test.pywork as expected. The strange thing is that all other arguments like-hand--versionwork fine in vscode, just--extension-pkg-whitelistseems to create problems.brettcannon commentedon Dec 12, 2018
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
.pylintrcfile instead of command-line flag to see if that changes things for some reason.fschlatt commentedon Dec 13, 2018
Ok, I'll update the issue if a find a solution.