Home > Article > Development Tools > VSCode prompts that the system cannot find the specified path
VSCode prompts that the system cannot find the specified path
Solution:
In vscode , click Debug->Open configuration, add "cwd":"" to the opened launch.json file,
After adding it, it will be as follows:
{ "version": "0.2.0", "configurations": [ { "name": "当前文件 (外部终端)", "type": "python", "request": "launch", "program": "${file}", "cwd": "${fileDirname}", "console": "externalTerminal" } ] }
VScode is indexed according to the path of the .vscode folder in the root directory of the workspace as an absolute path. If there are many folders in the workspace, and the py file in the folder needs to reference the file in the current directory , the file cannot be found by writing the relative path in the usual way. ${fileDirname} represents the absolute path of the currently opened file, excluding the file name. After setting, the normal relative path can be used in the py file to import document. ,
Recommended related articles and tutorials: vscode tutorial
The above is the detailed content of VSCode prompts that the system cannot find the specified path. For more information, please follow other related articles on the PHP Chinese website!