Python Forum

Full Version: New to Python-Unable to run a .py file in terminal
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi All
I have just started learning python and working on my MacBook Air using Terminal
I have saved a simple script with just one print command and named it ex1.py.
BTW I am using Python3.6.4
So I go to terminal and type Python3.6
It loads the python
I type Python3.6 ex1.py and press Enter and it gives me syntax error and points it to 6 in Python3.6
If I type Python3 ex1.py then it gives me same error but now points to 1 in ex1.py
Can anyone help
Hello!

Try:
python3 ex1.py

or

python ex1.py
(Feb-15-2018, 01:16 PM)AshishSangwan Wrote: [ -> ]So I go to terminal and type Python3.6
It loads the python
skip this step - this starts the python interactive interpreter
in terminal just write python ex1.py
(Feb-15-2018, 01:54 PM)buran Wrote: [ -> ]
(Feb-15-2018, 01:16 PM)AshishSangwan Wrote: [ -> ]So I go to terminal and type Python3.6
It loads the python
skip this step - this starts the python interactive interpreter
in terminal just write python ex1.py
yeah just figured this out, thanks man