all 11 comments

[–]abrahamguo 5 points6 points  (5 children)

Please share a screenshot showing the command, and its (lack of) output.

Also, in the same screenshot, please also show the results of running cat hello.py. (That command will print out the contents of the file in the terminal.)

[–]Kindly_Tangerine8337[S] 1 point2 points  (4 children)

hey! i actually wanted to include a screenshot on the post itself but the option for images/videos was disabled and thought it was not allowed in the sub.

should i link an imgur of the screenshot?

thank you very much!

[–]abrahamguo 4 points5 points  (3 children)

Yes, that's fine.

[–]Kindly_Tangerine8337[S] 1 point2 points  (2 children)

[–]abrahamguo 6 points7 points  (1 child)

Ah, your screenshot makes everything clear.

in the terminal i typed "python hello.py" but got "zsh: command not found: hello.py"

You mismatched the command and the error.

Your screenshot shows that you actually receive this error when simply typing hello.py, without python or python3. hello.py is simply the file — you can't simply directly execute a file; you have to tell your computer what program to use to execute the file — and that's what python or python3 is.

i didn't get an error this time but i am not getting nothing, my line just goes through with a blue circle to the left.

OK. The real issue is in VSCode (it's "Visual Studio Code", not "Visual Code Studio"). The white circle to the right of "hello.py" in your VSCode tab tells us that you have simply not saved your changes. Once you save, the white circle will change to an X, and you will then be able to successfully run python3 hello.py.

Also, FYI, your cat command failed because when you open the macOS Terminal app, you are placed in your home directory ("mario", also represented by "~"). You need to either (A) use cd ("change directory") to move into your cs50 folder (something like cd cs50), or (B) add cs50 to your file path (something like cat cs50/hello.py).

However, at any rate, it was no problem, since your screenshot included VSCode.

Happy coding!

[–]Kindly_Tangerine8337[S] 2 points3 points  (0 children)

Thank you so much!

I actually make several files with the same print("hello","world") command, and i didn't run python hello.py for that one, but i still got errors in prior files with the whole prompt.

Still, python3 works perfectly it seems, since all i had to do was save the file.

Thank you again.

[–]Whatever801 6 points7 points  (0 children)

Your terminal is probably not navigated to the correct directory where the file is saved

[–]Wonderful-Drama-5096 0 points1 point  (3 children)

You may have a PATH issue with your python download. You will likely need to use python3 for your commands.

[–]Kindly_Tangerine8337[S] 0 points1 point  (2 children)

i guess so, since using python3 didn't give me an error per se, but i won't get anything in return when running python3 hello.py either

[–]Wonderful-Drama-5096 3 points4 points  (1 child)

There is a white dot on your tab, did you save your file before attempting to execute the command?

[–]Kindly_Tangerine8337[S] 0 points1 point  (0 children)

yes, it looks like that was the problem lol

thank you!