Home  >  Article  >  Development Tools  >  VSCode prompts that the system cannot find the specified path

VSCode prompts that the system cannot find the specified path

angryTom
angryTomOriginal
2020-02-10 14:18:0613722browse

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn