{"name":"Python: Current File","type":"python","request":"launch","program":"${file}","cwd":"${workspaceFolder}"} 1. 2. 3. 4. 5. 6. 7. 这样就可以指定Python解释器的工作目录为VSCode的工作目录,从而解决相对路径无法读取文件的问题。 结语 通过以上方法,我们可以解决在VSCode中使用相对路径...
VSCode调试Python相对路径错误描述 发生异常: FileNotFoundError (note: full exception trace is shown but execution is paused at: <module>) [Errno 2] No such file or directory: 'setting.cfg' File "C:\Users\XQ-Garson\Desktop\Python\gz\runHttp.py", line 27, in <module> (Current frame) f ...