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

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

Closed
xyx0826 opened this issue May 31, 2019 · 12 comments
Closed

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

xyx0826 opened this issue May 31, 2019 · 12 comments
Assignees
Labels
area-debugging bug Issue identified by VS Code Team member as probable bug regression Bug didn't exist in a previous release

Comments

@xyx0826
Copy link

xyx0826 commented May 31, 2019

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

@ghost ghost added the triage-needed Needs assignment to the proper sub-team label May 31, 2019
@badatt
Copy link

badatt commented Jun 3, 2019

Ran into this issue today, so downgraded the extension to version 2019.4.12954.
I've tested for you in prod. JK @xyx0826

@ghost ghost removed the triage-needed Needs assignment to the proper sub-team label Jun 3, 2019
@ericsnowcurrently ericsnowcurrently added area-debugging bug Issue identified by VS Code Team member as probable bug labels Jun 3, 2019
@ericsnowcurrently
Copy link
Member

@xyx0826, thanks for letting us know about this. I have a few questions:

  • are those extra quotation marks something unique to your configuration or a filename?
  • what does your launch.json look like?
  • is this something new? (it sounds like it might be)

Ultimately a simple set of steps to reproduce the problem on our end would help a lot.

@ericsnowcurrently ericsnowcurrently added the info-needed Issue requires more information from poster label Jun 3, 2019
@xyx0826
Copy link
Author

xyx0826 commented Jun 3, 2019

@ericsnowcurrently, Thanks for your reply.

No I don't believe the quotes are unique to my environment, except for the fact that I have spaces in my username. I will update after I test with a path without spaces.

In fact I don't have a launch.json. I simply clicked on the green triangle to start the debugger in a fresh folder, on a fresh source file.

Yes, this issue started to appear recently (within a week?)

Thanks.

@ericsnowcurrently ericsnowcurrently removed the info-needed Issue requires more information from poster label Jun 4, 2019
@ericsnowcurrently
Copy link
Member

@DonJayamanne, any thoughts on where those extra quotation marks are coming from?

@DonJayamanne DonJayamanne self-assigned this Jun 5, 2019
@DonJayamanne DonJayamanne added regression Bug didn't exist in a previous release P0 labels Jun 5, 2019
@ericsnowcurrently ericsnowcurrently removed their assignment Jun 5, 2019
@badatt
Copy link

badatt commented Jun 6, 2019

@ericsnowcurrently providing some info that might help
image

@DonJayamanne DonJayamanne added this to the 2019 - May Sprint 11 milestone Jun 6, 2019
@DonJayamanne
Copy link

@BaluPraveen

  • Please could you copy the text thats sent to the terminal and paste it here.
    It's difficult to read the text from the screen shot.
    (not sure what ms-python.python-20rt... is. Hence the request to copy and paste the exact text here.
  • Also do you have a space in your user name.

@DonJayamanne
Copy link

@xyx0826
Do you have a space in your user name?

@xyx0826
Copy link
Author

xyx0826 commented Jun 6, 2019

@DonJayamanne, yes I do. Sorry I wasn't able to find a time to test it out with a space-free path.

@chrismclaurin
Copy link

I had the exact same issue and I do have a space in my name. On occasion, it presents issues with some Python packages, but it is rare.

Instead of renaming all my PATHs I downgraded the Extention to 2019.4.12954 and everything worked fine. I presume that it all started when I first upgraded to 2019.5.x.

@DonJayamanne
Copy link

Yes, we'll be resolving this soon. Apologies for the inconvenience caused.

@badatt
Copy link

badatt commented Jun 7, 2019

Issue was resolved in 2019.5.18875 version. Thanks @DonJayamanne & @ericsnowcurrently. 💯

@ghost ghost removed the triage label Jun 7, 2019
@DonJayamanne
Copy link

@BaluPraveen Thanks for the confirmation.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 14, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-debugging bug Issue identified by VS Code Team member as probable bug regression Bug didn't exist in a previous release
Projects
None yet
Development

No branches or pull requests

5 participants