2

I am trying to run a simple python code in Visual Studio Code. My launch.json looks like this :

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Python : Fichier actuel",
            "type": "python",
            "request": "launch",
            "program": "${file}",
            "console": "integratedTerminal"
        }
    ]
}

Here is the full error :

D:\Me\Documents\MEGA\IPSA\Aéro 3\Optimisation différentiable\TP-Projet>cd "d:\Me\Documents\MEGA\IPSA\Aéro 3\Optimisation différentiable\TP-Projet" && cmd /C "set "PYTHONIOENCODING=UTF-8" && set "PYTHONUNBUFFERED=1" && "C:\Users\My Username\AppData\Local\Programs\Python\Python37\python.exe" """c:/Users/My Username/.vscode/extensions/ms-python.python-2019.5.17517/pythonFiles/ptvsd_launcher.py""" --default --client --host localhost --port 9975 "d:\Me\Documents\MEGA\IPSA\Aéro 3\Optimisation différentiable\TP-Projet\projet.py" "
C:\Users\My Username\AppData\Local\Programs\Python\Python37\python.exe: can't open file '"c:/Users/My Username/.vscode/extensions/ms-python.python-2019.5.17517/pythonFiles/ptvsd_launcher.py"': [Errno 22] Invalid argument

The debugger doesn't start and an error message telling me the debugger doesn't respond appears. Did I do anything wrong ? Is it just a bug in how VS Code handles file paths ?

7
  • 1
    looks like there's some extra quoting. Seems like a command line bug. Can you try to put your script in a folder without spaces (not your user profile) ? Commented May 30, 2019 at 22:08
  • Same error : D:\TP-Projet>cd d:\TP-Projet && cmd /C "set "PYTHONIOENCODING=UTF-8" && set "PYTHONUNBUFFERED=1" && "C:\Users\My User\AppData\Local\Programs\Python\Python37\python.exe" """c:/Users/My User/.vscode/extensions/ms-python.python-2019.5.17517/pythonFiles/ptvsd_launcher.py""" --default --client --host localhost --port 10172 d:\TP-Projet\projet.py " C:\Users\My User\AppData\Local\Programs\Python\Python37\python.exe: can't open file '"c:/Users/My User/.vscode/extensions/ms-python.python-2019.5.17517/pythonFiles/ptvsd_launcher.py"': [Errno 22] Invalid argument Commented May 30, 2019 at 22:12
  • @Jean-FrançoisFabre It indeed looks like a bug, but dependant from where the Python extension is installed and not on the opened file path. Should we open a bug on Github ? Commented May 30, 2019 at 22:14
  • 1
    yes. c:/Users/My User/.vscode/extensions/ms-python.python-2019.5.17517/pythonFiles/ptvsd_launcher.py contains a space. (My User). You could try to rename your username that would be a good workaround Commented May 30, 2019 at 22:21
  • 1
    that said, this is not looking good: cmd /C "set "PYTHONIOENCODING=UTF-8" . The command is quoted, but there are quotes in the subcommands that should be triple quoted (or removed). Someone as Microsoft can't handle quoting properly... Commented May 30, 2019 at 22:25

1 Answer 1

1

Also have spaces in my username and for now you only need to run, try to roll your python extension back to 2019.4.12954 to avoid. It looks like a bug from 2019.5.17059.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.