I am new to the world of coding, which means I’m new to VS Code. Currently I’m self learning Python and typed in some code in VS Code to make sure I really understand what was going on (OOP if any of you are interested, class and instance attribute killed my dum dum brain, I understand it now tho).
However, when I typed in python name.py
in the terminal, it keeps on saying that “There is no such file or directory” even though I have the file opened.
Can someone explain what is going on? Thanks
Edit: I have found the problem, I was running my code in Powershell which I guess it is opened by default? Anyways, it couldn't find my file there and thus it keeps on saying that the file doesn't exist. I fixed it by creating a folder in desktop and making a file in the folder, then in the Explorer I right clicked the file and ran it successfully.
CodePudding user response:
It is most likely going to be due to an altered name of a file so when running the console is searching for a file that is no longer there (I often get this error when this has happened). However, it could also be due to the terminal not being in the current directory where said file is placed. If it is the first one just change the file back to the name it states in your console and your issue should be resolved.