Hello World terminal error

Hi I was following the episode 5-Your first Python Program (1- Getting started) and I got an error on the terminal.

[Uploading: Captura de pantalla 2022-09-10 a la(s) 20.20.52.jpg…]⠀

Looks like your upload never completed. What error did you get? Try to copy and paste the error here (rather than just uploading a screenshot).

thank you, yes! I think something happened with the image that I was uploading. Now I get the same error in the terminal. Please check this:

SyntaxError: invalid syntax

HelloWorld $python3 app.py
File “”, line 1
HelloWorld $python3 app.py
SyntaxError: invalid syntax

I try to use the terminal, but always I get and error. It’s so frustrating, because It stops me.

192-168-68-136:~ rbguerra$ HelloWorld $python3 app.py
sed: illegal option – r
usage: sed script [-Ealn] [-i extension] [file …]
sed [-Ealn] [-i extension] [-e script] … [-f script_file] … [file …]
bash: HelloWorld: command not found
192-168-68-136:~ rbguerra$

I continued the course and I still have the same error. I am in the 9 - Type conversion and I can’t use the terminal because say
[Uploading: error.jpg…]⠀

hi! thank you. Sorry but it is impossible upload the image. I try many times, I don’t know what happened with the format

this is what the terminal shows:

192-168-68-136:~ rbguerra$ HelloWorld $python3 app.py
bash: HelloWorld: command not found
192-168-68-136:~ rbguerra$

So about half of what you wrote there is actually just part of Mosh’s prompt in his shell. He is only typing python3 app.py (or simply python app.py)


ok, I think he typed “HelloWorld” to call the folder
after that he typed “$python3” because he and I, are using Mac (I don’t know what is the meaning of “$” before python3.
and finally “app.py” because that is the name of the file where we are working.

I am going to give you an example about what I want to do:

In the console I wrote
x = 1
y = 2
z = x + y

I want to see the value of the “z”, so first command+s, after I open the terminal like Mosh, I write the next sentence because I follow how Mosh do it.

HelloWorld $python3 app.py
after that I press Enter and the terminal shows me:

bash: HelloWorld: command not found
192-168-68-136:~ rbguerra$

I don’t know what is bash and also I don’t know those 11 numbers.

If you can help me will be great! Thank you!

As I said, you do not need to type “HelloWorld $” you should just type “python3 app.py” or “python app.py”. If necessary, you can first change directory into the same directory where the app.py file is located:

cd path/to/the/correct/directory
python app.py

bash is the shell you are using and the 11 numbers are probably an IP address (likely the one on your local network that your computer was assigned by DHCP on your router).


Yes! you were right, I wrote just python3 app.py, but now say

rbguerra$ python3 app.py
/Library/Frameworks/Python.framework/Versions/3.10/bin/python3: can’t open file ‘/Users/rbguerra/app.py’: [Errno 2] No such file or directory

In my code I wrote : x = input("x: "), so I was hoping to see something where write, but the terminal showed me the last message that I posted.

What it is mean change the directory? and How can I do that?

Thank for your help and your patience. I am not really good in this, for this reason I am doing this course

So this error means that app.py is not in your current working directory (which is /Users/rbguerra).

Think about your file navigator (which I think is called “Finder” on MacOS). There is one directory (or “folder”) that is currently open and you are looking at its contents. You can change to another directory by opening that directory. At the command line, we change directories using the cd (“change directory”) command and we can print our current (also known as “working”) directory using the pwd (“print working directory”) command.

So let us suppose your app.py file was located at /Users/rbguerra/HelloWorld/app.py and you are currently in the /Users/rbguerra directory. If we called pwd here is what we would get:

$ pwd

NOTE: I am using the $ character to represent whatever your prompt looks like (which is apparently "rbguerra$ " on your computer.

Now we can change directories to the HelloWorld directory and then print our current directory:

$ cd HelloWorld
$ pwd

Then you should be able to run python3 app.py and it will find the file.

If you prefer to not change directories, you can also just specify the full path to the app.py file from wherever you happen to be. That would look like this:

$ python3 /Users/rbguerra/HelloWorld/app.py

Or you could use a relative path if you know the path from where you currently are:

$ pwd
$ python HelloWorld/app.py
1 Like

thank you.

I tried to follow everything.

First, I wrote:

and I got in the next line:

After that I wrote:

I got a blinking cursor
Next, I wrote:

I got:
bash: /Users/rbguerra/Documents/HelloWorld: is a directory

After that I checked it with:

I got:

I don’t know if after cd, I should add



Now I can upload image!!!
Thank you for your help!

1 Like

So from your home directory (/Users/rbguerra/) you can change directory into your HelloWorld directory like this:

$ cd Documents/HelloWorld

Alternatively you can use the full path from any directory:

$ cd /Users/rbguerra/Documents/HelloWorld

Once there you can run this to execute your python file:

$ python app.py

You can also specify the full path to app.py to execute it from any directory:

$ python /Users/rbguerra/Documents/HelloWorld/app.py
1 Like

I see so many newbies like me have been going thru the same issues but Mosh has not cleared it on the video or any specific guideline on this. If we are having issues right in the beginning what should we expect later. Seems there is no proper support. Really disappointing. Should have stick with freecodecamp.

Hi pathon,

Are you having errors in the terminal when you run your python program? If so, please do share the error message and / or screenshot

Yeah. I was thinking the same thing.
It’s almost like the 1hr and 6hr course on YT is more up-to-date using PyCharm instead of VScode.

Well, I’ll keep muddling through til the 25 day mark.

Most of what Mosh is saying is clear, and goes fast, but when the video is from (guessing) 2018? and a 5 min lecture turns into 2hrs of troubleshooting, looking up other videos on YT for the answer …

Yeah, totally hear you pathon …

You’ve just expressed my mind

Thank you so much. This was so helpful.