Skip to content

python launch configs don't work when python interpreter path has a space in it and args is specified as a string instead of an arrayΒ #22258

@DetachHead

Description

@DetachHead

Environment data

  • Language Server version: n/a
  • OS and version: windows 10
  • Python version (& distribution if applicable, e.g. Anaconda): XXX

Code Snippet

# asdf.py (empty file)
// .vscode/launch.json
{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Python: doesn't work",
      "type": "python",
      "request": "launch",
      "module": "asdf",
      "args": "asdf"
    },
    {
      "name": "Python: works",
      "type": "python",
      "request": "launch",
      "module": "asdf",
      "args": ["asdf"]
    }
  ]
}

Repro Steps

  1. set your python interpreter to a location with a space in the path (eg. c:\users\user\documents\folder name\.venv\Scripts\python.exe)
  2. run both launch configs

Expected behavior

both work

Actual behavior

the following error when running "Python: doesn't work":

>  c:; cd 'c:\Users\user\documents\folder name'; c:\Users\user\documents\folder name\.venv\Scripts\python.exe c:\Users\user\.vscode\extensions\ms-python.python-2023.18.0\pythonFiles\lib\python\debugpy\adapter/../..\debugpy\launcher 49801 -- -m asdf asdf
c:\Users\user\documents\folder : The term 'c:\Users\user\documents\folder' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the      
name, or if a path was included, verify that the path is correct and try again.
At line:1 char:68
+ ... ocs no onedrive\pytest-robotframework'; c:\Users\user\documents\folder name ...
+                                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (c:\Users\user\documents\folder:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

Metadata

Metadata

Assignees

Labels

bugIssue identified by VS Code Team member as probable bugtriage-neededNeeds assignment to the proper sub-team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions