Closed STPiv closed 6 months ago
Can you verify few things?
See if this python exists and you are able to run it from the terminal: c:\MYUSER\AppData\Local\Programs\Python\Python312\python.exe
Make sure this location has the following files: c:\MYUSER\.vscode\extensions\ms-python.pylint-2023.10.1\bundled\tool
try running this manually from a terminal, it should not fail. If it ran successfully it will have a blank output waiting for you to terminate it.
c:\MYUSER\AppData\Local\Programs\Python\Python312\python.exe c:\MYUSER\.vscode\extensions\ms-python.pylint-2023.10.1\bundled\tool\lsp_server.py
It works both from a regular command line and from the terminal window within VSCode. Here is the output from within the VSCODE terminal:
PS C:\Development> python
Python 3.12.0 (tags/v3.12.0:0fb18b0, Oct 2 2023, 13:03:39) [MSC v.1935 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> exit(0)
PS C:\Development> C:\MYUSER\AppData\Local\Programs\Python\Python312\python.exe
Python 3.12.0 (tags/v3.12.0:0fb18b0, Oct 2 2023, 13:03:39) [MSC v.1935 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> exit(0)
PS C:\Development> C:\MYUSER\AppData\Local\Programs\Python\Python312\python.exe C:\MYUSER\.vscode\extensions\ms-python.pylint-2023.10.1\bundled\tool\lsp_server.py
^Z
PS C:\Development>
I can even run Pylint in the terminal within VSCode:
PS C:\Development> pylint .\PROJECT\scripts\utilInterpretVerifyReportResults.py --max-line-length=120 --module-naming-style=camelCase --function-naming-style=camelCase
************* Module utilInterpretVerifyReportResults
PROJECT\scripts\utilInterpretVerifyReportResults.py:44:4: R1705: Unnecessary "else" after "return", remove the "else" and de-indent the code inside it (no-else-return)
PROJECT\scripts\utilInterpretVerifyReportResults.py:78:4: C0103: Constant name "rc" doesn't conform to UPPER_CASE naming style (invalid-name)
------------------------------------------------------------------
Your code has been rated at 9.05/10 (previous run: 8.57/10, +0.48)
All of those files are in the directory.
@STPiv This is really strange. I don't see why it is failing to run. Can you try setting pylint.interpreter
to explicitly point to the interpreter ? C:\MYUSER\AppData\Local\Programs\Python\Python312\python.exe
.
Do you happen to have case sensitivity on for any folders? like using fsutil.exe file setCaseSensitiveInfo C:\folder enable
Do you have space or any non ascii characters in your user name?
I set the interpreter directly. No change I do not think I have any case sensitivity set. Never typed that command you list. My username does not have special characters, other than "." between my user and the domain name. It looks like "STPiv.COMPANY".
The fact that this happens at home as well, where my user name is different and there is no domain, makes me think that it has to do with some setting that is synchronized. I can't remember if I have updated the computer at home to Python 3.12. It might be at 3.10 still.
I have wracked my brain to try to remember if I changed anything around when this started being a problem. The only thing I can think of is that I changed the value of the "type" key inside my IntelliSense "configurations" list in my Python debug config to "debugpy". I did that because I got a message that the value I had there before (which I can't recall for the life of me) was going to be deprecated soon.
EDIT: That is in the .VSCode/launch.json file for the workspace.
Does this happen with a particular workspace or any workspace? Would it be possible to share the list of installed extensions? Also can you share similar part of the logs from autopep8 extension? basically part of the log that shows the command being used to launch the server.
The only thing I can think of is that I changed the value of the "type" key inside my IntelliSense "configurations" list in my Python debug config to "debugpy". I did that because I got a message that the value I had there before (which I can't recall for the life of me) was going to be deprecated soon.
That does not affect pylint extension.
Trying another workspace was an interesting test. I opened another window of VSCode, picked a different workspace, and opened a python script. Pylint worked.
So, what does that mean?
Here is a portion of the autopep8 log
2024-03-15 12:18:29.964 [info] c:\MYUSER\AppData\Local\Programs\Python\Python312\python.exe -m autopep8 --version
2024-03-15 12:18:29.964 [info] CWD Server: c:\Development\PROJECT
2024-03-15 12:18:30.600 [info] Version info for formatter running for C:\Development\PROJECT
autopep8 2.0.4 (pycodestyle: 2.11.1)
2024-03-15 12:18:30.601 [info] SUPPORTED autopep8>=1.7.0
Trying another workspace was an interesting test. I opened another window of VSCode, picked a different workspace, and opened a python script. Pylint worked. So, what does that mean?
It looks like where pylint
fails is a multi-root workspace. We need to investigate what in particular there is causing this. My current suspicion is that the current working directory is somehow incorrect and causing the server to fail to start with ENOENT
.
That was the hint!
Pylint: Cwd setting for the workspace that didn't work was ${filedirname} instead of ${fileDirname}.
I changed that setting and restarted VSCode and now Pylint is back to working.
I thought I changed the Pyling: Cwd setting at the workspace, but I changed it for the user. Not sure why that caused trouble in one workspace and not another. Thing is, make a reference to the correct variable in the settings seems to have resolved my issue.
I am glad we could figure this out. Happy Coding!
Thanks for the help. I've been beating my head against it off and on for weeks. It helped to have another set of eyes.
A couple of weeks ago Pylint stopped working for me in VSCode. I've searched the web and have not found a fix. I've seen posts about other issues that are close to but not the same as mine and tried what they've suggested:
settings.json
files for python.linting keysI have other extensions (autoPep8, Pylance, iSort, Python Debugger) that are able to connect to the python server and work. Just pylint is messing with me.
I have much of my setup synchronized between work and home computers and the problem happens on both.
Here is the Pylint output log: