Python File debugger fails due to triple quotes in command line
See original GitHub issueEnvironment 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:
- Create or open a Python file. (Reproductible with an empty file)
- Select
Debug > Start Debug > Python File
to start the current file under debugger. - 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
- (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
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:12 (2 by maintainers)
Top Results From Across the Web
How do I debug/launch program that has argument ...
The problem might be caused by the fact that everything is passed as an argument to cmd inside quotes. I use the standard...
Read more >Single, Double, and Triple Quotes in Python | by Yong Cui
How can we fix this error? One is to escape the single quote by placing a backslash before it. The other is to...
Read more >pdb — The Python Debugger
The module pdb defines an interactive source code debugger for Python programs. It supports setting (conditional) breakpoints and single stepping at the source ......
Read more >Debugging configurations for Python apps in Visual Studio Code
If you're only interested in debugging a Python script, the simplest way is to select the down-arrow next to the run button on...
Read more >Tips for using the Azure CLI successfully
command az vm show --resource-group myResourceGroup --name myVMname --query "{name: name, os:storageProfile.imageReference.offer}" --output ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Issue was resolved in
2019.5.18875
version. Thanks @DonJayamanne & @ericsnowcurrently. 💯Ran into this issue today, so downgraded the extension to version
2019.4.12954
. I’ve tested for you in prod. JK @xyx0826