# Error of "no such file"

**URL:** <https://forum.codewithmosh.com/t/error-of-no-such-file/11926>\
**Category:** Python\
**Created:** [April 15, 2022, 12:58pm UTC](https://forum.codewithmosh.com/t/error-of-no-such-file/11926 "2022-04-15T12:58:31Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bijal](https://avatars.discourse-cdn.com/v4/letter/b/e480ec/32.png) [@Bijal](https://forum.codewithmosh.com/u/Bijal)\
**Post date:** [April 15, 2022, 12:58pm UTC](https://forum.codewithmosh.com/t/error-of-no-such-file/11926/1 "2022-04-15T12:58:31Z")

</div>

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

 ![1650027421300223161691816877233](https://us1.discourse-cdn.com/flex020/uploads/codewithmosh/original/2X/6/65e41358c01c8ca4e935f6067ff74bb56846b47e.jpeg)

---

<div class="post-metadata">

**Author:** ![McP](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.codewithmosh.com/mcp/32/3593_2.png) [@McP](https://forum.codewithmosh.com/u/McP)\
**Post date:** [April 15, 2022, 1:21pm UTC](https://forum.codewithmosh.com/t/error-of-no-such-file/11926/2 "2022-04-15T13:21:25Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Bijal](https://avatars.discourse-cdn.com/v4/letter/b/e480ec/32.png) [@Bijal](https://forum.codewithmosh.com/u/Bijal)\
**Post date:** [April 16, 2022, 5:51am UTC](https://forum.codewithmosh.com/t/error-of-no-such-file/11926/3 "2022-04-16T05:51:54Z")

</div>

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…

 ![1650088221711776970962382860656](https://us1.discourse-cdn.com/flex020/uploads/codewithmosh/original/2X/7/7b90b7ea4a5db32e6ff99bc2869bf69ee2e9a297.jpeg)

---

<div class="post-metadata">

**Author:** ![McP](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.codewithmosh.com/mcp/32/3593_2.png) [@McP](https://forum.codewithmosh.com/u/McP)\
**Post date:** [April 16, 2022, 9:14am UTC](https://forum.codewithmosh.com/t/error-of-no-such-file/11926/4 "2022-04-16T09:14:32Z")

</div>

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’

---

<div class="post-metadata">

**Author:** ![McP](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.codewithmosh.com/mcp/32/3593_2.png) [@McP](https://forum.codewithmosh.com/u/McP)\
**Post date:** [April 16, 2022, 9:35am UTC](https://forum.codewithmosh.com/t/error-of-no-such-file/11926/5 "2022-04-16T09:35:38Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Bijal](https://avatars.discourse-cdn.com/v4/letter/b/e480ec/32.png) [@Bijal](https://forum.codewithmosh.com/u/Bijal)\
**Post date:** [April 16, 2022, 12:23pm UTC](https://forum.codewithmosh.com/t/error-of-no-such-file/11926/6 "2022-04-16T12:23:03Z")

</div>

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