Beginner Confusion

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::pray:

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 :disappointed_relieved:

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

  1. Run python [insert full path to hello.py, e.g. C:\something\hello.py]. Or,

  2. 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:

  1. Change your default directory to the location of the file you intend to run.
    or
  2. 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.

alternate_run_module

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

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

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

Thank you so much😍

1 Like

I see it. My user name is just user so I see
C:\Users\ User>

Okay, I have removed it. Thank you!

Okay, I will do that thank you! I have visual studio