Mein Skript befindet sich hier:
Code: Select all
C:\Users\USERNAME\FolderName - With Spaces\_MyHome\Documents\Dev\Python\my_script.py
Code: Select all
"C:\Users\USERNAME\FolderName - With Spaces\_MyHome\Documents\Dev\temp\test.txt"
Code: Select all
{
// 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 Debugger: Current File with Arguments",
"type": "debugpy",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"args": "${command:pickArgs}"
}
]
}

Danach spuckt das Debug-Terminal unten den aus Folgendes:
Code: Select all
PS C:\Users\USERNAME\FolderName - With Spaces\_MyHome\Documents\Dev\Python> c:; cd 'c:\Users\USERNAME\FolderName - With Spaces\_MyHome\Documents\Dev\Python'; c:\Users\USERNAME\AppData\Local\Programs\Python\Python312\python.exe c:\Users\USERNAME\.vscode\extensions\ms-python.debugpy-2025.14.1-win32-x64\bundled\libs\debugpy\launcher 50410 -- C:\Users\USERNAME\FolderName - With Spaces\_MyHome\Documents\Dev\Python\my_script.py "C:\Users\USERNAME\FolderName - With Spaces\_MyHome\Documents\Dev\temp\test.txt"
Traceback (most recent call last):
File "c:\Users\USERNAME\AppData\Local\Programs\Python\Python312\Lib\runpy.py", line 198, in _run_module_as_main
return _run_code(code, main_globals, None,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\Users\USERNAME\AppData\Local\Programs\Python\Python312\Lib\runpy.py", line 88, in _run_code
exec(code, run_globals)
File "c:\Users\USERNAME\.vscode\extensions\ms-python.debugpy-2025.14.1-win32-x64\bundled\libs\debugpy\launcher/../..\debugpy\__main__.py", line 71, in
cli.main()
File "c:\Users\USERNAME\.vscode\extensions\ms-python.debugpy-2025.14.1-win32-x64\bundled\libs\debugpy\launcher/../..\debugpy/..\debugpy\server\cli.py", line 508, in main
run()
File "c:\Users\USERNAME\.vscode\extensions\ms-python.debugpy-2025.14.1-win32-x64\bundled\libs\debugpy\launcher/../..\debugpy/..\debugpy\server\cli.py", line 358, in run_file
runpy.run_path(target, run_name="__main__")
File "c:\Users\USERNAME\.vscode\extensions\ms-python.debugpy-2025.14.1-win32-x64\bundled\libs\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_runpy.py", line 309, in run_path
code, fname = _get_code_from_file(run_name, path_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\Users\USERNAME\.vscode\extensions\ms-python.debugpy-2025.14.1-win32-x64\bundled\libs\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_runpy.py", line 278, in _get_code_from_file
with io_open_code(decoded_path) as f:
^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\USERNAME\\FolderName'
PS C:\Users\USERNAME\FolderName - With Spaces\_MyHome\Documents\Dev\Python>

Aber ich bekam immer noch einen ähnlichen Fehler, wie unten gezeigt:
Code: Select all
PS C:\Users\USERNAME\FolderName - With Spaces\_MyHome\Documents\Dev\Python> c:; cd 'c:\Users\USERNAME\FolderName - With Spaces\_MyHome\Documents\Dev\Python'; c:\Users\USERNAME\AppData\Local\Programs\Python\Python312\python.exe c:\Users\USERNAME\.vscode\extensions\ms-python.debugpy-2025.14.1-win32-x64\bundled\libs\debugpy\launcher 53983 -- C:\Users\USERNAME\FolderName - With Spaces\_MyHome\Documents\Dev\Python\my_script.py "C:\Users\USERNAME\Downloads\test.txt"
Traceback (most recent call last):
File "c:\Users\USERNAME\AppData\Local\Programs\Python\Python312\Lib\runpy.py", line 198, in _run_module_as_main
return _run_code(code, main_globals, None,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\Users\USERNAME\AppData\Local\Programs\Python\Python312\Lib\runpy.py", line 88, in _run_code
exec(code, run_globals)
File "c:\Users\USERNAME\.vscode\extensions\ms-python.debugpy-2025.14.1-win32-x64\bundled\libs\debugpy\launcher/../..\debugpy\__main__.py", line 71, in
cli.main()
File "c:\Users\USERNAME\.vscode\extensions\ms-python.debugpy-2025.14.1-win32-x64\bundled\libs\debugpy\launcher/../..\debugpy/..\debugpy\server\cli.py", line 508, in main
run()
File "c:\Users\USERNAME\.vscode\extensions\ms-python.debugpy-2025.14.1-win32-x64\bundled\libs\debugpy\launcher/../..\debugpy/..\debugpy\server\cli.py", line 358, in run_file
runpy.run_path(target, run_name="__main__")
File "c:\Users\USERNAME\.vscode\extensions\ms-python.debugpy-2025.14.1-win32-x64\bundled\libs\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_runpy.py", line 309, in run_path
code, fname = _get_code_from_file(run_name, path_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\Users\USERNAME\.vscode\extensions\ms-python.debugpy-2025.14.1-win32-x64\bundled\libs\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_runpy.py", line 278, in _get_code_from_file
with io_open_code(decoded_path) as f:
^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\USERNAME\\FolderName'
PS C:\Users\USERNAME\FolderName - With Spaces\_MyHome\Documents\Dev\Python>

Beim Versuch, die Ausführung rückwärts zu verfolgen, denke ich, dass es hier in cli.py möglicherweise bremst:

da es anscheinend keine vollständig qualifizierten Pfade mit Leerzeichen verarbeitet. Das heißt, wenn es ausgeführt wird, muss es das Skript selbst als Argument aufrufen, und es scheint das Skriptargument zu sein, das nicht korrekt in doppelte Anführungszeichen gesetzt wird, wie es sein müsste.
Ich bin mir nicht 100 % sicher, wo genau das behoben werden soll...
Mobile version