Error of "no such file"

Hello friends,
I am getting an error of " no such file or directory "[Error2]…
I already move the file to different folder and also rename file still showing same error.
Please let me know how to solve this error.

Thanks

Hi Bijal

The terminal (lower screen) currently expects to find ‘error.py’ in C:\Users\Bijal lakhani. But we can see it is actually located on your F drive. So, in the terminal try entering this instead…

py F:\Python files\Visual Studio code projects\Practice_1\error.py

Thanks for reply .
But its not working by default it taking “c:\users\Bijal lakhani>” …how to change this thing in window power shell…
Picture is attached for your reference …output window is working perfectly fine…

OK. I see what’s wrong now.

The terminal is fine. The idea is that it keeps ‘C:\Users\Bijal lakhani>’ as the active directory. All we are trying to do is show it where error.py is located on your F drive. What’s tripping us is that you have folder names on your F drive containing spaces. That’s OK but we must make a small change to allow for that.

So in your teminal instead of entering…

py F:\Python files\Visual Studio code projects\Practice_1\error.py

enter…

py “F:\Python files\Visual Studio code projects\Practice_1\error.py”

By using the “”, we prevent the spaces from causing a problem. You can see from your error message that the problem starts with the first space located at ‘F:\Python’

Just to mention, if the above has worked but you prefer to change your terminal folder to make life easier, in Visual Studio Code (top left) choose File → Open Folder → Then choose the Practice_1 folder located at F:\Python files\Visual Studio code projects\Practice_1

1 Like

Thank u so much…finally its working…i for mosh basic lecture …i think i need to revise…thank u once again

1 Like