Skip to content
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

Add CWD to "Server: Start failed" trace output #331

Open
clayg opened this issue Oct 31, 2024 · 0 comments
Open

Add CWD to "Server: Start failed" trace output #331

clayg opened this issue Oct 31, 2024 · 0 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug triage-needed

Comments

@clayg
Copy link

clayg commented Oct 31, 2024

Diagnostic Data

  • Python version (& distribution if applicable, e.g., Anaconda):
(.venv) clayg@ThinkStation:~/Workspace/vagrant-swift-all-in-one$ python --version
Python 3.12.3
  • Type of virtual environment used (e.g., conda, venv, virtualenv, etc.): python -m venv .venv
  • Operating system (and version): Windows 11, WSL w/ ubuntu
  • Version of tool extension you are using:
Name: Flake8
Id: ms-python.flake8
Description: Linting support for Python files using Flake8.
Version: 2023.10.0
Publisher: Microsoft
VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=ms-python.flake8

Behaviour

Expected Behavior

Ability to control which flake8 I'm running in which venv in which path - per project - in a WSL environment.

Actual Behavior

Flake8 server fails with cryptic error message

2024-10-31 13:56:57.894 [info] Name: Flake8
2024-10-31 13:56:57.894 [info] Module: flake8
2024-10-31 13:56:57.895 [info] Interpreter from setting flake8.interpreter: /mnt/c/Users/cgerrard/Workspace/vagrant-swift-all-in-one/.venv/bin/python
2024-10-31 13:56:57.895 [info] Interpreter from setting flake8.interpreter: /mnt/c/Users/cgerrard/Workspace/vagrant-swift-all-in-one/.venv/bin/python
2024-10-31 13:56:57.895 [info] Server run command: /mnt/c/Users/cgerrard/Workspace/vagrant-swift-all-in-one/.venv/bin/python /home/clayg/.vscode-server/extensions/ms-python.flake8-2023.10.0/bundled/tool/lsp_server.py
2024-10-31 13:56:57.895 [info] Server: Start requested.
2024-10-31 13:56:57.895 [info] [Error - 1:56:57 PM] Flake8 client: couldn't create connection to server.
2024-10-31 13:56:57.895 [info] Launching server using command /mnt/c/Users/cgerrard/Workspace/vagrant-swift-all-in-one/.venv/bin/python failed. Error: spawn /mnt/c/Users/cgerrard/Workspace/vagrant-swift-all-in-one/.venv/bin/python ENOENT
2024-10-31 13:56:57.895 [error] Server: Start failed: Launching server using command /mnt/c/Users/cgerrard/Workspace/vagrant-swift-all-in-one/.venv/bin/python failed. Error: spawn /mnt/c/Users/cgerrard/Workspace/vagrant-swift-all-in-one/.venv/bin/python ENOENT

Reproduction Steps:

change:

    "flake8.cwd": "${cwd}",

to:

    "flake8.cwd": "${fileDirname}",

Logs:

2024-10-31 13:56:57.894 [info] Name: Flake8
2024-10-31 13:56:57.894 [info] Module: flake8
2024-10-31 13:56:57.895 [info] Interpreter from setting flake8.interpreter: /mnt/c/Users/cgerrard/Workspace/vagrant-swift-all-in-one/.venv/bin/python
2024-10-31 13:56:57.895 [info] Interpreter from setting flake8.interpreter: /mnt/c/Users/cgerrard/Workspace/vagrant-swift-all-in-one/.venv/bin/python
2024-10-31 13:56:57.895 [info] Server run command: /mnt/c/Users/cgerrard/Workspace/vagrant-swift-all-in-one/.venv/bin/python /home/clayg/.vscode-server/extensions/ms-python.flake8-2023.10.0/bundled/tool/lsp_server.py
2024-10-31 13:56:57.895 [info] Server: Start requested.
2024-10-31 13:56:57.895 [info] [Error - 1:56:57 PM] Flake8 client: couldn't create connection to server.
2024-10-31 13:56:57.895 [info] Launching server using command /mnt/c/Users/cgerrard/Workspace/vagrant-swift-all-in-one/.venv/bin/python failed. Error: spawn /mnt/c/Users/cgerrard/Workspace/vagrant-swift-all-in-one/.venv/bin/python ENOENT
2024-10-31 13:56:57.895 [error] Server: Start failed: Launching server using command /mnt/c/Users/cgerrard/Workspace/vagrant-swift-all-in-one/.venv/bin/python failed. Error: spawn /mnt/c/Users/cgerrard/Workspace/vagrant-swift-all-in-one/.venv/bin/python ENOENT
2024-10-31 14:01:32.190 [info] Interpreter from setting flake8.interpreter: /mnt/c/Users/cgerrard/Workspace/vagrant-swift-all-in-one/.venv/bin/python
2024-10-31 14:01:32.190 [info] Server: Stop requested
2024-10-31 14:01:32.191 [error] Server: Stop failed: Error: Client is not running and can't be stopped. It's current state is: startFailed
2024-10-31 14:01:32.191 [info] Interpreter from setting flake8.interpreter: /mnt/c/Users/cgerrard/Workspace/vagrant-swift-all-in-one/.venv/bin/python
2024-10-31 14:01:32.193 [info] Server run command: /mnt/c/Users/cgerrard/Workspace/vagrant-swift-all-in-one/.venv/bin/python /home/clayg/.vscode-server/extensions/ms-python.flake8-2023.10.0/bundled/tool/lsp_server.py
2024-10-31 14:01:32.193 [info] Server: Start requested.
2024-10-31 14:01:33.138 [info] CWD Server: /mnt/c/Users/cgerrard/AppData/Local/Programs/Microsoft VS Code
2024-10-31 14:01:33.138 [info] sys.path used to run Server:
   /home/clayg/.vscode-server/extensions/ms-python.flake8-2023.10.0/bundled/tool
   /usr/lib/python312.zip
   /usr/lib/python3.12
   /usr/lib/python3.12/lib-dynload
   /mnt/c/Users/cgerrard/Workspace/vagrant-swift-all-in-one/.venv/lib/python3.12/site-packages
   /home/clayg/.vscode-server/extensions/ms-python.flake8-2023.10.0/bundled/libs
2024-10-31 14:01:33.138 [info] Settings used to run Server:
[
    {
        "cwd": "/mnt/c/Users/cgerrard/AppData/Local/Programs/Microsoft VS Code",
        "workspace": "file:///home/clayg/Workspace/vagrant-swift-all-in-one",
        "args": [],
        "severity": {
            "E": "Error",
            "F": "Error",
            "I": "Information",
            "W": "Warning"
        },
        "path": [],
        "ignorePatterns": [],
        "interpreter": [
            "/mnt/c/Users/cgerrard/Workspace/vagrant-swift-all-in-one/.venv/bin/python"
        ],
        "importStrategy": "fromEnvironment",
        "showNotifications": "off"
    }
]

2024-10-31 14:01:33.138 [info] Global settings:
{
    "cwd": "${workspaceFolder}",
    "workspace": "/mnt/c/Users/cgerrard/AppData/Local/Programs/Microsoft VS Code",
    "args": [],
    "severity": {
        "E": "Error",
        "F": "Error",
        "I": "Information",
        "W": "Warning"
    },
    "path": [],
    "ignorePatterns": [],
    "interpreter": [],
    "importStrategy": "useBundled",
    "showNotifications": "off"
}

2024-10-31 14:01:33.197 [info] /mnt/c/Users/cgerrard/Workspace/vagrant-swift-all-in-one/.venv/bin/python -m flake8 --version
2024-10-31 14:01:33.197 [info] CWD Linter: /mnt/c/Users/cgerrard/AppData/Local/Programs/Microsoft VS Code
2024-10-31 14:01:34.291 [info] 
6.1.0 (hacking: 6.1.0, mccabe: 0.7.0, pycodestyle: 2.11.1, pyflakes: 3.1.0)
CPython 3.12.3 on Linux


2024-10-31 14:01:34.291 [info] Version info for linter running for /mnt/c/Users/cgerrard/Workspace/vagrant-swift-all-in-one:
6.1.0 (hacking: 6.1.0, mccabe: 0.7.0, pycodestyle: 2.11.1, pyflakes: 3.1.0)
CPython 3.12.3 on Linux

2024-10-31 14:01:34.291 [info] SUPPORTED flake8>=5.0.0
FOUND flake8==6.1.0

2024-10-31 14:01:34.331 [info] [Trace - 2:01:34 PM] Received notification 'window/logMessage'.
2024-10-31 14:01:34.332 [info] /mnt/c/Users/cgerrard/Workspace/vagrant-swift-all-in-one/.venv/bin/python -m flake8 --format='%(row)d,%(col)d,%(code).1s,%(code)s:%(text)s' /home/clayg/Workspace/vagrant-swift-all-in-one/swift/test/unit/obj/test_expirer.py
2024-10-31 14:01:34.332 [info] [Trace - 2:01:34 PM] Received notification 'window/logMessage'.
2024-10-31 14:01:34.332 [info] CWD Linter: /mnt/c/Users/cgerrard/AppData/Local/Programs/Microsoft VS Code
2024-10-31 14:01:34.822 [info] [Trace - 2:01:34 PM] Received notification 'window/logMessage'.
2024-10-31 14:01:34.822 [info] file:///home/clayg/Workspace/vagrant-swift-all-in-one/swift/test/unit/obj/test_expirer.py :
'18,1,H,H306::imports not in alphabetical order (os, itertools)'
'20,26,H,H301::one import per line'
'22,31,H,H301::one import per line'
'24,1,H,H306::imports not in alphabetical order (tempfile.mkdtemp, shutil.rmtree)'
'25,1,H,H306::imports not in alphabetical order (shutil.rmtree, collections.defaultdict)'
'28,1,H,H216::The unittest.mock module should be used rather than the third party mock package unless actually needed. If so, disable the H216 check in hacking config and ensure mock is declared in the project's requirements.'
'32,41,H,H301::one import per line'
'34,1,H,H306::imports not in alphabetical order (swift.common.utils.timestamp, swift.common.swob.response)'
'35,30,H,H301::one import per line'
'55,1,H,H404::multi line docstring should start without a leading new line'
'55,1,H,H405::multi line docstring summary not separated with an empty line'
'56,1,H,H404::multi line docstring should start without a leading new line'
'56,1,H,H405::multi line docstring summary not separated with an empty line'
'57,1,H,H404::multi line docstring should start without a leading new line'
'57,1,H,H405::multi line docstring summary not separated with an empty line'
'58,1,H,H404::multi line docstring should start without a leading new line'
'58,1,H,H405::multi line docstring summary not separated with an empty line'
'59,1,H,H404::multi line docstring should start without a leading new line'
'59,1,H,H405::multi line docstring summary not separated with an empty line'
'60,1,H,H404::multi line docstring should start without a leading new line'
'60,1,H,H405::multi line docstring summary not separated with an empty line'
'61,1,H,H404::multi line docstring should start without a leading new line'
'61,1,H,H405::multi line docstring summary not separated with an empty line'
'62,1,H,H404::multi line docstring should start without a leading new line'
'62,1,H,H405::multi line docstring summary not separated with an empty line'
'63,1,H,H404::multi line docstring should start without a leading new line'
'63,1,H,H405::multi line docstring summary not separated with an empty line'
'64,1,H,H404::multi line docstring should start without a leading new line'
'64,1,H,H405::multi line docstring summary not separated with an empty line'
'65,1,H,H404::multi line docstring should start without a leading new line'
'65,1,H,H405::multi line docstring summary not separated with an empty line'
'66,1,H,H404::multi line docstring should start without a leading new line'
'66,1,H,H405::multi line docstring summary not separated with an empty line'
'67,1,H,H404::multi line docstring should start without a leading new line'
'67,1,H,H405::multi line docstring summary not separated with an empty line'
'68,1,H,H404::multi line docstring should start without a leading new line'
'68,1,H,H405::multi line docstring summary not separated with an empty line'
'69,1,H,H404::multi line docstring should start without a leading new line'
'69,1,H,H405::multi line docstring summary not separated with an empty line'
'70,1,H,H404::multi line docstring should start without a leading new line'
'70,1,H,H405::multi line docstring summary not separated with an empty line'
'71,1,H,H404::multi line docstring should start without a leading new line'
'71,1,H,H405::multi line docstring summary not separated with an empty line'
'72,1,H,H404::multi line docstring should start without a leading new line'
'72,1,H,H405::multi line docstring summary not separated with an empty line'
'2190,1,H,H404::multi line docstring should start without a leading new line'
'2190,1,H,H405::multi line docstring summary not separated with an empty line'
'2191,1,H,H404::multi line docstring should start without a leading new line'
'2191,1,H,H405::multi line docstring summary not separated with an empty line'
'2192,1,H,H404::multi line docstring should start without a leading new line'
'2192,1,H,H405::multi line docstring summary not separated with an empty line'
'2195,9,E,E731:do not assign a lambda expression, use a def'
'2197,9,E,E731:do not assign a lambda expression, use a def'
'2199,29,E,E128:continuation line under-indented for visual indent'
'2651,11,W,W292:no newline at end of file'

2024-10-31 14:01:34.849 [info] [Trace - 2:01:34 PM] Received notification 'textDocument/publishDiagnostics'.
2024-10-31 14:02:56.492 [info] Interpreter from setting flake8.interpreter: /mnt/c/Users/cgerrard/Workspace/vagrant-swift-all-in-one/.venv/bin/python
2024-10-31 14:02:56.493 [info] Server: Stop requested
2024-10-31 14:02:56.497 [info] Interpreter from setting flake8.interpreter: /mnt/c/Users/cgerrard/Workspace/vagrant-swift-all-in-one/.venv/bin/python
2024-10-31 14:02:56.499 [info] Server run command: /mnt/c/Users/cgerrard/Workspace/vagrant-swift-all-in-one/.venv/bin/python /home/clayg/.vscode-server/extensions/ms-python.flake8-2023.10.0/bundled/tool/lsp_server.py
2024-10-31 14:02:56.499 [info] Server: Start requested.
2024-10-31 14:02:56.502 [info] [Error - 2:02:56 PM] Flake8 client: couldn't create connection to server.
2024-10-31 14:02:56.502 [info] Launching server using command /mnt/c/Users/cgerrard/Workspace/vagrant-swift-all-in-one/.venv/bin/python failed. Error: spawn /mnt/c/Users/cgerrard/Workspace/vagrant-swift-all-in-one/.venv/bin/python ENOENT
2024-10-31 14:02:56.502 [error] Server: Start failed: Launching server using command /mnt/c/Users/cgerrard/Workspace/vagrant-swift-all-in-one/.venv/bin/python failed. Error: spawn /mnt/c/Users/cgerrard/Workspace/vagrant-swift-all-in-one/.venv/bin/python ENOENT
2024-10-31 14:03:52.787 [info] Interpreter from setting flake8.interpreter: /mnt/c/Users/cgerrard/Workspace/vagrant-swift-all-in-one/.venv/bin/python
2024-10-31 14:03:52.787 [info] Server: Stop requested
2024-10-31 14:03:52.788 [error] Server: Stop failed: Error: Client is not running and can't be stopped. It's current state is: startFailed
2024-10-31 14:03:52.788 [info] Interpreter from setting flake8.interpreter: /mnt/c/Users/cgerrard/Workspace/vagrant-swift-all-in-one/.venv/bin/python
2024-10-31 14:03:52.791 [info] Server run command: /mnt/c/Users/cgerrard/Workspace/vagrant-swift-all-in-one/.venv/bin/python /home/clayg/.vscode-server/extensions/ms-python.flake8-2023.10.0/bundled/tool/lsp_server.py
2024-10-31 14:03:52.791 [info] Server: Start requested.
2024-10-31 14:03:52.791 [debug] Server State: Starting
2024-10-31 14:03:52.793 [debug] Server State: Stopped
2024-10-31 14:03:52.793 [info] [Error - 2:03:52 PM] Flake8 client: couldn't create connection to server.
2024-10-31 14:03:52.793 [info] Launching server using command /mnt/c/Users/cgerrard/Workspace/vagrant-swift-all-in-one/.venv/bin/python failed. Error: spawn /mnt/c/Users/cgerrard/Workspace/vagrant-swift-all-in-one/.venv/bin/python ENOENT
2024-10-31 14:03:52.793 [error] Server: Start failed: Launching server using command /mnt/c/Users/cgerrard/Workspace/vagrant-swift-all-in-one/.venv/bin/python failed. Error: spawn /mnt/c/Users/cgerrard/Workspace/vagrant-swift-all-in-one/.venv/bin/python ENOENT

Outcome When Attempting Debugging Steps:

(.venv) clayg@ThinkStation:~/Workspace/vagrant-swift-all-in-one$ ls -alhF /mnt/c/Users/cgerrard/Workspace/vagrant-swift-all-in-one/.venv/bin/python
lrwxrwxrwx 1 clayg clayg 7 Oct 30 16:09 /mnt/c/Users/cgerrard/Workspace/vagrant-swift-all-in-one/.venv/bin/python -> python3*
(.venv) clayg@ThinkStation:~/Workspace/vagrant-swift-all-in-one$ ls -alhF /mnt/c/Users/cgerrard/Workspace/vagrant-swift-all-in-one/.venv/bin/python3
lrwxrwxrwx 1 clayg clayg 12 Oct 30 16:09 /mnt/c/Users/cgerrard/Workspace/vagrant-swift-all-in-one/.venv/bin/python3 -> /bin/python3*
(.venv) clayg@ThinkStation:~/Workspace/vagrant-swift-all-in-one$ /bin/python3 --version
Python 3.12.3
(.venv) clayg@ThinkStation:~/Workspace/vagrant-swift-all-in-one$ ls -alhF /home/clayg/.vscode-server/extensions/ms-python.flake8-2023.10.0/bundled/tool/lsp_server.py
-rw-r--r-- 1 clayg clayg 25K Oct 31 10:33 /home/clayg/.vscode-server/extensions/ms-python.flake8-2023.10.0/bundled/tool/lsp_server.py

Extra Details

I think the ENOENT is actually the flake8.cwd path - not anything to do with the server/python path. When I change that one setting back to ${cwd} the server starts fine (and gives me the wrong flake8 errors because it's not finding the sub-projects tox.ini). I think ${fileDirname) must be sending the flake8 server (which I think IS running in the WSL venv) to use a cwd with a c:\-style path instead of the /mnt/c-style path and the python flake8 server running under WSL can't find it? Just a guess, cause ${relativeFileDirname} fails the same way but an explicit /mnt/c/Users/cgerrard/Workspace/vagrant-swift-all-in-one/works and I can't get any additional debug/trace information. Is there WSL compatible versions of ${fileDirname}?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue identified by VS Code Team member as probable bug triage-needed
Projects
None yet
Development

No branches or pull requests

2 participants