Skip to content

Python File debugger fails due to triple quotes in command line #5861

@xyx0826

Description

@xyx0826

Environment data

  • VS Code version: 1.34.0 (user setup) a622c65b2c713c890fcf4fbf07cf34049d5fe758
  • Extension version: 2019.6.17655-dev
  • OS and version: Windows_NT x64 10.0.18898
  • Python version: v3.7.3:ef4ec6ed12 w/ pip
  • Type of virtual environment used: venv
  • Relevant/affected Python packages and their versions: None

Expected behaviour

The Python File debugging configuration is able to run the current Python file under the debugger.

Actual behaviour

Triple quotes in the debugger bootstrap command leads to an error.

Steps to reproduce:

  1. Create or open a Python file. (Reproductible with an empty file)
  2. Select Debug > Start Debug > Python File to start the current file under debugger.
  3. The following command will be executed:
cd "c:\Users\[USERNAME]\Source\Repos\test" && cmd /C "set "PYTHONIOENCODING=UTF-8" && set "PYTHONUNBUFFERED=1" && 
"C:\Users\[USERNAME]\.virtualenvs\iet\Scripts\python.exe" """c:/Users/[USERNAME]/.vscode/extensions/ms-python.python-2019.6.17655-dev/pythonFiles/ptvsd_launcher.py""" --default --client 
--host localhost --port 53696 "c:\Users\[USERNAME]\Source\Repos\test\app.py" "

(Reproductible with Python 2.7 and non-venv Python 3)
4. The following error will be displayed:

C:\Users\[USERNAME]\.virtualenvs\iet\Scripts\python.exe: can't open file '"c:/Users/[USERNAME]/.vscode/extensions/ms-python.python-2019.6.17655-dev/pythonFiles/ptvsd_launcher.py"': [Errno 22] Invalid argument
  1. (Workaround) While VSCode is still waiting for debugger, manually execute the following command:
"C:\Users\[USERNAME]\.virtualenvs\iet\Scripts\python.exe" "c:/Users/[USERNAME]/.vscode/extensions/ms-python.python-2019.6.17655-dev/pythonFiles/ptvsd_launcher.py" --default --client 
--host localhost --port 53696 "c:\Users\[USERNAME]\Source\Repos\test\app.py" "

(Note the triple quotes have been replaced by single quotes)
6. The debuggerdebuggee successfully starts and connects to VSCode, debugging begins.

Logs

Starting Microsoft Python language server.
Downloading https://pvsc.azureedge.net/python-language-server-stable/Python-Language-Server-win-x64.0.2.87.nupkg... complete
Unpacking archive... done
[Info  - 下午8:13:04] GetCurrentSearchPaths C:\Users\[USERNAME]\.virtualenvs\iet\Scripts\python.exe 
[Info  - 下午8:13:04] Python search paths:
[Info  - 下午8:13:04]     c:\users\[USERNAME]\.virtualenvs\iet\lib
[Info  - 下午8:13:04]     c:\users\[USERNAME]\.virtualenvs\iet\scripts
[Info  - 下午8:13:04]     c:\users\[USERNAME]\appdata\local\programs\python\python37\lib
[Info  - 下午8:13:04]     c:\users\[USERNAME]\appdata\local\programs\python\python37\dlls
[Info  - 下午8:13:04]     c:\users\[USERNAME]\.virtualenvs\iet
[Info  - 下午8:13:04]     c:\users\[USERNAME]\.virtualenvs\iet\lib\site-packages
[Info  - 下午8:13:04] Configuration search paths:
[Info  - 下午8:13:07] Microsoft Python Language Server version 0.2.87.0
[Info  - 下午8:13:07] Initializing for C:\Users\[USERNAME]\.virtualenvs\iet\Scripts\python.exe
[Info  - 下午8:23:13] GetCurrentSearchPaths C:\python27-x64\python.exe 
[Info  - 下午8:23:13] Python search paths:
[Info  - 下午8:23:13]     c:\python27-x64\dlls
[Info  - 下午8:23:13]     c:\python27-x64\lib
[Info  - 下午8:23:13]     c:\python27-x64\lib\lib-tk
[Info  - 下午8:23:13]     c:\python27-x64
[Info  - 下午8:23:13]     c:\users\[USERNAME]\appdata\roaming\python\python27\site-packages
[Info  - 下午8:23:13]     c:\python27-x64\lib\site-packages
[Info  - 下午8:23:13] Configuration search paths:
[Info  - 下午8:23:14] Microsoft Python Language Server version 0.2.87.0
[Info  - 下午8:23:14] Initializing for C:\python27-x64\python.exe
[Info  - 下午8:23:43] GetCurrentSearchPaths C:\Users\[USERNAME]\.virtualenvs\iet\Scripts\python.exe 
[Info  - 下午8:23:43] Python search paths:
[Info  - 下午8:23:43]     c:\users\[USERNAME]\.virtualenvs\iet\lib
[Info  - 下午8:23:43]     c:\users\[USERNAME]\.virtualenvs\iet\scripts
[Info  - 下午8:23:43]     c:\users\[USERNAME]\appdata\local\programs\python\python37\lib
[Info  - 下午8:23:43]     c:\users\[USERNAME]\appdata\local\programs\python\python37\dlls
[Info  - 下午8:23:43]     c:\users\[USERNAME]\.virtualenvs\iet
[Info  - 下午8:23:43]     c:\users\[USERNAME]\.virtualenvs\iet\lib\site-packages
[Info  - 下午8:23:43] Configuration search paths:
[Info  - 下午8:23:45] Microsoft Python Language Server version 0.2.87.0
[Info  - 下午8:23:45] Initializing for C:\Users\[USERNAME]\.virtualenvs\iet\Scripts\python.exe

Output from Console under the Developer Tools panel: https://gist.github.com/xyx0826/ef472d164cc5e7265f361fd70234e72f

Metadata

Metadata

Assignees

Labels

area-debuggingbugIssue identified by VS Code Team member as probable bugregressionBug didn't exist in a previous release

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions