r/learnpython • u/agreigaighte • 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.
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
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
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
2
u/carcigenicate Carcigenicate Jul 01 '25
What is the error?