Python Forum
New to Python-Unable to run a .py file in terminal
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
New to Python-Unable to run a .py file in terminal
#1
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
Reply
#2
Hello!

Try:
python3 ex1.py

or

python ex1.py
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply
#3
(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
Reply
#4
(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
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  invoking python in Terminal Euler 2 624 Aug-25-2023, 06:17 AM
Last Post: perfringo
  Launch Python IDLE Shell from terminal Pavel_47 5 1,225 Feb-17-2023, 02:53 PM
Last Post: Pavel_47
  Python VS Code: using print command twice but not getting output from terminal kdx264 4 1,078 Jan-16-2023, 07:38 PM
Last Post: Skaperen
  Unable to upload file using FTP korenron 2 2,479 Dec-23-2021, 12:44 PM
Last Post: korenron
  Dynamic Printing With Python Terminal MrTim 2 2,904 Jul-06-2021, 04:00 PM
Last Post: MrTim
  Running latest Python version on the Terminal (MAC) Damian 4 2,640 Mar-22-2021, 07:58 AM
Last Post: Damian
  keyboard module doesn't work in the microsoft version terminal of python. username 1 2,803 Feb-25-2021, 05:19 PM
Last Post: Larz60+
  gnome terminal playing with python jmex 12 6,147 Feb-03-2021, 01:38 PM
Last Post: Axel_Erfurt
  Refresh data in python script while running in Terminal frankenchrist 4 7,251 Feb-03-2021, 09:54 AM
Last Post: Larz60+
  Unable to capture all images of a multipage TIFF file in a merge bendersbender 0 2,211 Nov-19-2020, 03:09 PM
Last Post: bendersbender

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020