I’m receiving the error below when I type HelloWorld $python app.py in the terminal.
HelloWorld : The term ‘HelloWorld’ is not recognized as the name of a cmdlet,
function, script file, or operable program. Check the spelling of the name, or if a
path was included, verify that the path is correct and try again.
At line:1 char:1
Try typing this into your terminal after the $ (you do not type the $): python app.py
.
This should run your program called app.py
. In that app.py file I am assuming you wrote something like this:
print("Hello World")
When you installed Python you installed some software, right? One of those pieces of software is called the python interpreter. It is a program that runs python code. The command to run this is also called python.
Remember when you installed python and were asked if you want to add it to your Path variable? Well the Path variable is a special variable that holds directories of programs (and other things). Your operating system doesn’t magically know what python is, but it looks for the name of a file called python within the directories stored in the path variable, so this is why they ask if you want to add python to it. When it finds python in the list of directories in Path then it runs it and passes in options and arguments you specified. In your case you are passing in the name of the script you would like to run which is called app.py
So python is a programming language, and also the name of a program you installed. You call it by typing python
. There is probably not a command in your path variable or computer called Hello World
so your error is telling you that doesn’t exist.
I am kinda skimming over the topic of how to use terminals, shells, PATH variables, and the interpreter. I hope it gives you a little bit of a glimpse into what is actually happening. I highly recommend spending some time to just learn the basics of how to use your terminal program and shells to interact with your operating system. You can learn the basics of it very fast and it is extremely powerful.
Sorry this was so lengthy. I try my best to explain the why of something rather than “just type this and begone”.