r/learnpython • • Jul 01 '25

"cd Desktop\python_work" just doesn't work.

I'm on the 12 page of this book> I am simply trying to run a dang "Hello Python World" on the terminal and it just can't find the file. It's in the OneDrive, and even when I add it to the path, it still can't find it. I have uninstalled and reinstalled Python and VScode, shoot, I reinstalled Windows, no change.

Am I doing something wrong? Clearly I am, but what? I've followed what everybody was saying on stack overflow and if I'm going by what I'm reading in command prompt, that file just doesn't exist DESPITE ME LOOKING AT IT RIGHT NOW!!!!!

Please, I need help with this.

2 Upvotes

37 comments sorted by

2

u/carcigenicate Carcigenicate Jul 01 '25

What is the error?

1

u/agreigaighte Jul 01 '25

cd : Cannot find path 'C:\Users\Name\Desktop\python_work' because it does not exist.

At line:1 char:1

+ cd Desktop\python_work

+ ~~~~~~~~~~~~~~~~~~~~~~

+ CategoryInfo : ObjectNotFound: (C:\Users\Name\Desktop\python_work:String) [Set-Location], ItemNotFound

Exception

+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.SetLocationCommand

or

hello_world.py : The term 'hello_world.py' is not recognized as the name of a cmdlet, function, script file, or

operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try

again.

At line:1 char:1

+ hello_world.py

+ ~~~~~~~~~~~~~~

+ CategoryInfo : ObjectNotFound: (hello_world.py:String) [], CommandNotFoundException

+ FullyQualifiedErrorId : CommandNotFoundException

1

u/carcigenicate Carcigenicate Jul 01 '25

Double check both that you have a Desktop directory in your Name user directory (it can be moved), and also that you have a python_work directory on your desktop.

1

u/agreigaighte Jul 01 '25

PS C:\Users\name\Onedrive\Desktop\python_work>

I've only gotten this far. Everything is where it should be from what I'm seeing.

6

u/carcigenicate Carcigenicate Jul 01 '25

Ok, ya, that's a common problem. Idk why, but I've seen a lot of desktops ending up in a Onedrive directory. I think Windows does it automatically when you enable Onedrive. You can't always use exact paths taken from books and other resources for reasons like this.

1

u/agreigaighte Jul 01 '25

I absolutely hate OneDrive, should I just uninstall it?

1

u/carcigenicate Carcigenicate Jul 01 '25

I never enabled it, so I don't have enough experience with it to give an opinion.

1

u/tr0w_way Jul 02 '25

I recommend just making a "projects" directory that is not on onedrive and using that. I usually do C:\Users\name\projects. Or better yet, use WSL/Dual Boot

Onedrive can be nice for making file system backups, but it's a nightmare for this sort of thing

1

u/carcigenicate Carcigenicate Jul 01 '25

If there's a new error, what is it?

1

u/agreigaighte Jul 01 '25

It's saying that the file "hello_world.py" doesn't exist.

1

u/carcigenicate Carcigenicate Jul 01 '25

What's the command you ran, and what's the exact error?

1

u/agreigaighte Jul 01 '25 edited Jul 02 '25

PS : Cannot find a process with the name "C:\Users\name\Onedrive\Desktop\python_work". Verify the process name and

call the cmdlet again.

At line:1 char:1

+ PS C:\Users\tyjmh\Onedrive\Desktop\python_work

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ CategoryInfo : ObjectNotFound: (C:\Users\name\...top\python_work:String) [Get-Process], ProcessCommand

Exception

+ FullyQualifiedErrorId : NoProcessFoundForGivenName,Microsoft.PowerShell.Commands.GetProcessCommand

1

u/carcigenicate Carcigenicate Jul 02 '25

PS C:\Users\tyjmh\Onedrive\Desktop\python_work

Did you run that literally as a command? Like, did you type PS?

1

u/agreigaighte Jul 02 '25

No, I just copied and pasted the entire path. I typed everything after the name.

→ More replies (0)

1

u/JollyUnder Jul 02 '25

So you've successfully changed directory to your project file so that your terminal reads:

PS C:\Users\name\Onedrive\Desktop\python_work>

If so, type python hello_world.py into your terminal to execute your program.

PS C:\Users\name\Onedrive\Desktop\python_work> python hello_world.py

1

u/agreigaighte Jul 02 '25

Get-Process : A positional parameter cannot be found that accepts argument 'python'.

At line:1 char:1

+ PS C:\Users\name\Onedrive\Desktop\python_work> python hello_world.py

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ CategoryInfo : InvalidArgument: (:) [Get-Process], ParameterBindingException

+ FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.GetProcessCommand

1

u/JollyUnder Jul 02 '25

What are you typing into your terminal that produces that error message?

1

u/agreigaighte Jul 02 '25
cd Onedrive\Desktop\python_work> python hello_world.py and 

cd Onedrive\Desktop\python_work> hello_world.py
→ More replies (0)

3

u/GXWT Jul 01 '25

In the future you need to describe the actual problem and exact error you are getting. Else, we are just guessing. How are we meant to read your mind…?

Presumably you are not in the correct directory. That command is assuming you are in the root (the most upper level) directory and is looking for folder Desktop within that. But if you are already in some other directory it won’t find it.

Run “pwd” to see where you are

And then either correctly use a path relative to where you are “cd ../Desktop/python_work” for example, or use an absolute path “cd ~/Desktop/python_work”

The tilde basically means root directory.

To give someone directions to your house, you must either tell them the directions from where they already are, or tell them some directions from some predetermined main location like the town hall. That analogy is for the relative or absolute pathing, respectively

-19

u/agreigaighte Jul 01 '25

Okay dude, my fault. I wasn't thinking. I'm not demanding anyone read my mind.

6

u/Oh-Hunny Jul 02 '25

The commenter you’re responding to is trying to help you out, not making a judgement or anything like that. They are explaining the norms of asking questions online in coding or technical communities. You’ll find it will be a lot easier and faster to get answers to your questions when you describe things more clearly.

It helps out the people that could help you out.

1

u/GXWT Jul 02 '25

OK dude

8

u/AlexMTBDude Jul 02 '25

Your problem has got nothing to do with Python. You need to learn how to use the Windows command prompt. Watch a tutorial video on Youtube.

1

u/No_Row_1971 Jul 02 '25

Open your powershell in windows and try this out instead cd "$HOME\Desktop\python_work" python3 -u hello_world.py

1

u/unity-thru-absurdity Jul 02 '25

Can you inspect the file path to find the exact name? You may have to do “cd OneDrive” then “cd Desktop”, but I’m not sure how that works because OneDrive is technically the cloud.

1

u/lolcrunchy Jul 02 '25

You should spend two minutes and watch this video

1

u/FoolsSeldom Jul 02 '25

I have had the same problem with OneDrive. It looks like you have the file, but when you try to run it you get a not found error.

iirc, you should right-click in Explorer on every folder / file and tell it to keep a local copy.

1

u/JohnLocksTheKey Jul 02 '25 edited Jul 02 '25

Installing OneDrive does funky stuff to the Windows file system

Right-click a file you know is on your desktop, copy path, open command prompt then cd <paste> (replace file name from path with python_work)

Then hit enter

1

u/sukkj Jul 02 '25

The file doesn't exist.