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 ?
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 argumentc:/Users/My User/.vscode/extensions/ms-python.python-2019.5.17517/pythonFiles/ptvsd_launcher.pycontains a space. (My User). You could try to rename your username that would be a good workaroundcmd /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...