Home > Development Tools > VSCode > body text

What should I do if vscode cannot find the path?

藏色散人
Release: 2020-04-02 09:08:07
Original
9597 people have browsed it

What should I do if vscode cannot find the path?

#What should I do if vscode cannot find the path?

Solution to the problem that the VS code file reference cannot find the path

Recommended learning: vscode tutorial

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, follow the usual The file cannot be found when writing a relative path. In this case, you need to add "cwd": "${fileDirname}" to the launch.json file in the .vscode folder and the debugging environment used to specify where to debug. Find the file, ${fileDirname} represents the absolute path of the currently opened file, excluding the file name, so that after setting, the normal relative path can be used to introduce the file in the py file.

Example:

{
"name": "当前文件 (外部终端)",
"type": "python",
"request": "launch",
"program": "${file}",
"cwd": "${fileDirname}",
"console": "externalTerminal"
 }
Copy after login

The above is the detailed content of What should I do if vscode cannot find the path?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!