pylint pkgwhitelist working
See original GitHub issueEnvironment 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
.
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (4 by maintainers)
Top GitHub Comments
Ok, I’ll update the issue if a find a solution.
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.