Home > Back-end >  No Such File Or Directory In VSC
No Such File Or Directory In VSC

Time:04-23

Just jumped into learning Python, and installed Visual Studio Code. Just to test it out, to run a simple print('hi) and saved the file in the working directory. However, powershell pops up and presents me with Error Message.. I found the Python: Execute In File Dir setting an enabled that and still no luck. I'm running Windows 11. Any advice would be appreciated.

Thank you.

CodePudding user response:

I think your file is saved in some another directory and your command line is at "C:\Users\trevo".

You should always go to the folder in which your project or code is and then open that folder as workspace in VS Code. Or else use the cd command and go to the directory where the code is stored and run the python command then.

CodePudding user response:

To run your code, you should type in the command prompt:

cd <insert (raw) directory that your file is in>

python <your file name>.py

  • Related