1

I am running Python3 with the latest Python Launcher on my Mac, the scripts are run on Mac Terminal. It is a chatbot script, sort of Eliza knockoff in Python version. This is what I got from the Mac terminal. Couldn't run it and I used input() instead of raw_input() since this is Python3.

 Desktop/doctor.py'  && echo Exit status: $? && exit 1
 Hello. How are you feeling today?
 > I am fine.
 Traceback (most recent call last):
 File "/Users/Gary/Desktop/doctor.py", line 256, in <module>
 main()
 File "/Users/Gary/Desktop/doctor.py", line 248, in main
 statement = input("> ")
 File "<string>", line 1
 I am fine.
   ^
 SyntaxError: invalid syntax

However, when I run it on repl.it, it works fine. I wonder what is wrong with my mac.. thanks guys

Gary Lai
  • 19
  • 1
  • I’m willing to bet that this is running python 2 and trying to eval your input. Macs come with python 2 installed by default. If you change to `raw_input` you’ll fix most of the issues. Or install python 3. – cole Nov 08 '18 at 08:14
  • Damn! Thanks a lot.. my sublime and vs code are all using version 3, I dont know why terminal still uses version 2.. thanks a lot anyway! Have a nice day! – Gary Lai Nov 08 '18 at 09:05

0 Answers0