ruka
(RukaN)
February 12, 2024, 5:23pm
1
Hello
Please someone help me.
I just downloaded python like an hour ago and spent the entire hour trying to figure out what I did wrong.
I started learning it today and I am stuck. I don’t know what to do
Please help:pleading_face:
I tried opening a file using: python hello.py
But it’s not working ‘hello’ I s the name of my file. I saved it under the fileextension .py. I don’t know what is wrong. The only thing in my code is
Print(“Hello World”)
And it still didn’t work.
I know it’s like dumb and funny but I feel stupid. I can’t even figure out what is wrong
What happened when you ran your hello.py script?
Share the output here as preformatted text useing the </> button.
Once we can see what happened we can help.
The error is because hello.py
is not on the current working directory. This is not really about python, but more about learning to use the terminal.
Solution: Find where you save the file hello.py
. Then, either
Run python [insert full path to hello.py, e.g. C:\something\hello.py]
. Or,
Run cd [insert path to the directory where hello.py is residing, e.g. C:\something]
to change your working directory. Then run python hello.py
.
1 Like
That is probably because your file is not in the same location as your default directory. Make sure you:
Change your default directory to the location of the file you intend to run.
or
You save the file that you intend to run to the location of your default directory.
If you have IDLE
downloaded, you can open the module that you intend to run, and run it without
worrying about the two options.
It will run it without worry or concern of your default directory. By selecting the Run Module
option from the Options
drop-down menu, it will make the directory where the module is located as the active directory.
1 Like
MRAB
(Matthew Barnett)
February 12, 2024, 9:32pm
7
Don’t put your programs in C:\Windows; this folder is part of the operating system itself.
You can put your programs in, say, a folder in your Documents folder.
On Windows, it’s recommended that you use the Python Launcher py
:
py hello.py
1 Like
tjreedy
(Terry Jan Reedy)
February 13, 2024, 6:05am
8
When I start Command Prompt, the initial prompt is
C:\Users\Terry>
, which is what is should be. If I enter the set
command,
C:\Users\Terry>set
, I see
...
HOMEDRIVE=C:
HOMEPATH=\Users\Terry
...
USERNAME=Terry
USERPROFILE=C:\Users\Terry
You should see the same thing but with your username. If not, what?
1 Like
ruka
(RukaN)
February 13, 2024, 6:20am
10
I see it. My user name is just user so I see
C:\Users\ User>
ruka
(RukaN)
February 13, 2024, 6:20am
11
Okay, I have removed it. Thank you!
ruka
(RukaN)
February 13, 2024, 6:22am
12
Okay, I will do that thank you! I have visual studio