Ex1 no such file or directory

Hi Mr. Shaw,
Could you please check why my code doesn’t work?

Windows PowerShell
Copyright © Microsoft Corporation. All rights reserved.

PS C:\WINDOWS\system32> cd lpthw
PS C:\WINDOWS\system32\lpthw> dir

Directory: C:\WINDOWS\system32\lpthw

Mode LastWriteTime Length Name

-a---- 2019-03-21 10:00 PM 198 ex1.py
-a---- 2019-03-21 9:41 PM 19 test.txt

PS C:\WINDOWS\system32\lpthw> python ex1.py
C:\Users\sanny\AppData\Local\Programs\Python\Python37-32\python.exe: can’t open file ‘ex1.py’: [Errno 2] No such file or directory

The root folders are different in these two commands, I don’t know if it is because of that, my pc is win10.
Thank you very much!

Hello @sannyhc

You should not have your lpthw folder in C:\WINDOWS\system32.

Move it to your home directory. Or desktop.
Use powershell or ”drag and drop” to move it there.
Look at the appendix on how to use the commandline. Powershell in your case.

And yes. You seems to have tried to run the code from where your python is installed.
Your code is “far away” from there.

Move your code to your Home directory.
Start Powershell and type:

chdir ~


chdir \Users\sanny 



in here and you should find your file.

Its even better to create or move your lpthw folder here and save all exercises in there.
Perhaps even subfolder for later use.

I believe I sent this to you, but you should NOT put anything in C:\windows\system32. NEver ever put files there. Take this lpthw directory and move it to your home directory in C:\Users\sanny\

thank you @ulfen69, it works!!

Yes I got it, thank you very much!

Hello @sannyhc

Good to hear.
I hope you feel you are back on track again.