运行Python文件时VS Code错误22

时间:2019-05-30 21:54:10

标签: python visual-studio-code path runtime-error execution

我试图在Visual Studio Code中运行一个简单的python代码。我的launch.json看起来像这样:

{
    // 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"
        }
    ]
}

这是完整的错误:

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

调试器无法启动,并且出现一条错误消息,告诉我调试器没有响应。我做错了什么吗?这只是VS Code处理文件路径的错误吗?

1 个答案:

答案 0 :(得分:1)

我的用户名中也有空格,现在您只需要运行,请尝试将python扩展回滚至2019.4.12954,以避免发生。看起来像是来自2019.5.17059的错误。