Trouble opening files in python with VS Code

后端 未结 3 2051
情书的邮戳
情书的邮戳 2020-12-06 15:49

I can\'t seem to open basic text files when I run a python script in VS Code, the code runs fine when I use it in Idle but VSCode will give me a FileNotFound error, is there

相关标签:
3条回答
  • 2020-12-06 16:06

    In your VSCode for Windows

    File --> Preferences --> Settings --> (User)Extensions --> Python -->

    Terminal: Execute In File Dir --> Check It

    or

    File --> Preferences --> Settings --> Search Settings --> python.terminal.executeInFileDir

    0 讨论(0)
  • 2020-12-06 16:20

    Whenever you need to debug, you need to change the path of the file to open it in debug mode by simply:

    1. Going to the explorer
    2. Right click on the file and click on copy relative path
    3. Put that path in open

    That should help you!

    0 讨论(0)
  • 2020-12-06 16:30

    Try setting

    "python.terminal.executeInFileDir": true,

    in your VSCode Settings

    0 讨论(0)
提交回复
热议问题