Python Course- Beginner #5

Print(“Hello World”) is giving me the following when I type $python app.py.
At line:1 char:9

  • $python app.py
  •             ~~~~~~
    

Unexpected token ‘app.py’ in expression or statment.

I’ve tried
python app.py
$python
etc. with no luck

Hi @wingsr34 are you running the python command from the same directory where your app.py file is located?

I’m following the instructions. I type print(“Hello”), then ctrl S, then ctrl ~ and thats when I get the error at the bottom. I created the file in my D:/ and then opend the folder, and then opened the file in that folder and started from there.

$python app.py gives me the same result. On the previous attempt I tried $Pythonfile app.py

Firstly, you should not type $python app.py Just python app.py. If this does not work, please enter python --version in this terminal window and post the result. Also if you can post the result of ls

Ok, it all works. First, I was using the wrong quick keys. Maybe VSC updated or changed their quick keys from the time Mosh recorded his video? But it runs using ctrl + f5 or typing python app.py as you mentioned.

Moving on.
Thanks for the help Paul.

1 Like

Hello i am getting the same if i want the output. But if i right click and click on “run python file in terminal” am getting the output. attached screenshot

can you please guide me on above comment?

Looks like python is not installed on your computer? If you did install python, then find the directory it was installed to and add the /bin folder to your PATH variable.