I am trying to run python code inside Vs code, when I click "Run Python File" Option from top right (play icon). It shows "FileNotFoundError: [Errno 2] No such file or directory: 'jpgs'"
Upon using "pwd" command in same terminal, it shows It's in "/Users/arsh" Directory instead of my python project directory. I have to cd to that folder and run the button to make it working.
Is there any way in VS code to run the python file from current folder automatically? So every time I don't need to tell terminal to goto project folder then run "Run python code" command from VS Code.
In addition to the answers posted already, consider assigning a keyboard shortcut as follows in your keybindings.json:
{
"key": "cmd+shift+alt+t",
"command": "workbench.action.terminal.newWithCwd",
"args": {
"cwd": "${fileDirname}"
}
}
This will open a terminal in the folder containing the active file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With