Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/visual-studio-code/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
运行Python文件时VS代码错误22_Python_Visual Studio Code_Path_Runtime Error_Execution - Fatal编程技术网

运行Python文件时VS代码错误22

运行Python文件时VS代码错误22,python,visual-studio-code,path,runtime-error,execution,Python,Visual Studio Code,Path,Runtime Error,Execution,我试图在VisualStudio代码中运行一个简单的python代码。My 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

我试图在VisualStudio代码中运行一个简单的python代码。My 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代码处理文件路径的一个缺陷吗

我的用户名中也有空格,现在您只需要运行,尝试将python扩展回滚到2019.4.12954以避免出现错误。它看起来像是2019.5.17059的一个bug。

看起来有一些额外的报价。看起来像是一个命令行错误。你能把你的脚本放在一个没有空格的文件夹里吗(不是你的用户档案)?同样的错误:
D:\TP Projet>cd D:\TP Projet&&cmd/C“set”pythonionecoding=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”“--默认值--客户端--主机本地主机--端口10172 d:\TP Projet\Projet.py“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””:[Errno 22]无效参数
@Jean Françoisfare它看起来确实像一个bug,但取决于Python扩展的安装位置,而不是打开的文件路径。我们应该在Github上打开bug吗?是的。
c:/Users/My User/.vscode/extensions/ms Python.Python-2019.5.17517/pythonFiles/ptvsd_launcher.py
包含一个空格。(我的用户)。您可以尝试重命名您的用户名,这将是一个很好的解决方法,也就是说,这看起来不太好:
cmd/C“set”pythonionecoding=UTF-8“
。命令被引用,但子命令中的引号应被三重引用(或删除)。像微软这样的人无法正确处理报价。。。