Closed timeterror closed 2 years ago
You're using 2.13.4 which is not the last pylint version, could you upgrade pylint and confirm it's still an issue ?
I can't reproduce on main
and not with 2.13.4
.
Are you sure this is the version that the extension is using? Is it perhaps using a version installed globally? Or in another environment?
The latest version of the extension uses Pylint 2.13.7 and still shows the same issue
Running PyLint 2.13.8 from a local env without using the VSCode extension works if I run the following:
pylint --reports=n --output-format=json --max-line-length=100 --disable=C0413,W0105,W0511,W1201,W1202,W1203 --extension-pkg-whitelist=pyodbc,pandas,numpy --ignored-classes=DatetimeIndex,ExtensionIndex,Index --good-names=Run,_ --max-args=25 --ignore-long-lines=^\s*(# )?.*<?https?://\S+>?$|^\s*(\w*\s*=\s*)?("|\').*("|\'),?\s*$ --argument-rgx=\b[a-zA-Z_][a-zA-Z0-9_]{0,30} --attr-rgx=\b[a-zA-Z_][a-zA-Z0-9_]{0,30} --class-rgx=\b[a-zA-Z_][a-zA-Z0-9_]{0,30} --const-rgx=\b[a-zA-Z_][a-zA-Z0-9_]{0,30} --function-rgx=\b[a-zA-Z_][a-zA-Z0-9_]{0,30} --method-rgx=\b[a-zA-Z_][a-zA-Z0-9_]{0,30} --module-rgx=\b[a-zA-Z_][a-zA-Z0-9_]{0,30} --variable-rgx=\b[a-zA-Z_][a-zA-Z0-9_]{0,30} --inlinevar-rgx=\b[a-zA-Z_][a-zA-Z0-9_]{0,30} --from-stdin c:\repos\pipelines\pylint_issue_example.py
So, I am guessing this is more related to the Extension than PyLint.
@timeterror when you run like that pylint
does not receive the content. You have to run it like this:
type c:\repos\pipelines\pylint_issue_example.py | pylint --reports=n --output-format=json --max-line-length=100 --disable=C0413,W0105,W0511,W1201,W1202,W1203 --extension-pkg-whitelist=pyodbc,pandas,numpy --ignored-classes=DatetimeIndex,ExtensionIndex,Index --good-names=Run,_ --max-args=25 --ignore-long-lines=^\s*(# )?.*<?https?://\S+>?$|^\s*(\w*\s*=\s*)?("|\').*("|\'),?\s*$ --argument-rgx=\b[a-zA-Z_][a-zA-Z0-9_]{0,30} --attr-rgx=\b[a-zA-Z_][a-zA-Z0-9_]{0,30} --class-rgx=\b[a-zA-Z_][a-zA-Z0-9_]{0,30} --const-rgx=\b[a-zA-Z_][a-zA-Z0-9_]{0,30} --function-rgx=\b[a-zA-Z_][a-zA-Z0-9_]{0,30} --method-rgx=\b[a-zA-Z_][a-zA-Z0-9_]{0,30} --module-rgx=\b[a-zA-Z_][a-zA-Z0-9_]{0,30} --variable-rgx=\b[a-zA-Z_][a-zA-Z0-9_]{0,30} --inlinevar-rgx=\b[a-zA-Z_][a-zA-Z0-9_]{0,30} --from-stdin c:\repos\pipelines\pylint_issue_example.py
Also, you can look at the Output > Pylint panel to see details on what is being used to run pylint. including the sys.path
.
I tried to reproduce this in the extension, i don't see this occuring:
The extension will use whatever python interpreter is selected in VS Code. You need to verify which python interpreter that is and make sure you get a python3 -m pip list
from that interpreter. I have a hunch that in whatever intepreter that is, astroid
is below 2.11. 🤞🏻 (I guess you could verify that pylint chokes when uninstalling astroid
from the interpreter you think is being used.)
First off, my apologies for the slow response, especially with all the help you all have given me.
In any case, I tried to play around with my environments and the vs-code extension but could not find out what was going wrong. Eventually I ended up removing all my envs, uninstalling the extension, and then reinstalling everything. This failed, but repeating this while deleting all the lingering files from my drives before reinstalling everything, it all is working as expected. It is a pity I was unable to pinpoint what exactly is going wrong, but I am certain the issue has nothing to do with pylint itself.
Thank you all for helping.
I has similar error. It turns out to be a astroid
version mismatch with pylint
$ pylint --version
pylint 2.14.5
astroid 2.9.0
Python 3.8.10 (default, Nov 26 2021, 20:14:08)
[GCC 9.3.0]
I compared pylint --version
with a partner who has no problem with it. Then I found I have a astroid
installed in /home/MY_NAME/.local/lib/python3.8/site-packages
.
$ ls ~/.local/lib/python3.8/site-packages
__pycache__
astroid
astroid-2.9.0.dist-info
After uninstalling it, pylint --version
is the same as my partner. The problem doesn't exist anymore.
$ pip3 uninstall astroid
$ pyline --version
pylint 2.14.5
astroid 2.11.7
Python 3.8.10 (default, Nov 26 2021, 20:14:08)
[GCC 9.3.0]
Bug description
Issue was bumped from https://github.com/microsoft/vscode-pylint/issues/77.
pylint crashed with an
AttributeError
and with the following stacktrace:Configuration
The extension settings are:
Command used
Pylint output
Expected behavior
For the linter not to crash
Pylint version
OS / Environment
Windows 10