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

View all comments

Show parent comments

1

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

cd Onedrive\Desktop\python_work> hello_world.py

2

u/JollyUnder Jul 02 '25

Lets start over.

You have a folder on your desktop named python_work which contains a file named hello_world.py.

Open command prompt and upon opening the terminal it should look like this:

Microsoft Windows [Version 10.0.19045.5965]
(c) Microsoft Corporation. All rights reserved.

C:\Users\Name>

Now you need to change the working directory to your project folder, which located on your desktop. Type cd Onedrive\Desktop\python_work into your terminal and press <Return>.

Your terminal should now look like this, which indicates you've successfully changed your working directory to your project folder:

Microsoft Windows [Version 10.0.19045.5965]
(c) Microsoft Corporation. All rights reserved.

C:\Users\Name>cd Onedrive\Desktop\python_work

C:\Users\Name\Onedrive\Desktop\python_work>

Now enter python hello_world.py into the terminal. Assuming your code is print('Hello, World!'), your terminal should now look like this:

Microsoft Windows [Version 10.0.19045.5965]
(c) Microsoft Corporation. All rights reserved.

C:\Users\Name>cd Onedrive\Desktop\python_work

C:\Users\Name\Onedrive\Desktop\python_work>python hello_world.py
Hello, World!

C:\Users\Name\Onedrive\Desktop\python_work>

2

u/agreigaighte Jul 02 '25

so what the fuck.

it worked. first things first, thank you. i will always remember the help you gave me.

seconds. what the fuck. i typed some variation of that exactly. i worked in both command prompt and powershell.

2

u/JollyUnder Jul 02 '25

Glad you finally got it working.

For future reference, you can hold shift and right-click your project folder. There should be an option Open PowerShell window here in the context menu. That will open PowerShell with the working directory set to your project folder.

3

u/agreigaighte Jul 02 '25

BET THANK YOU

1

u/aaaaAaaaAaaARRRR Jul 02 '25

If you’re in powershell, you can tab complete. If it doesn’t exist, it won’t complete when you press tab.