[docs] Python 3.1.2 Syntax Error

Timothy Long thairish at mac.com
Mon Oct 18 05:44:07 CEST 2010


Dear Python Volunteers,
   
   Let me preface the statement of the problem by saying that I am very new to python and have done any programming in about 10 years. I'm taking an online course via MIT open courseware in which the class uses python. I downloaded 3.1.2 onto my  MacBook which is running OS 10.6.4.

Initially I tried running some of the basic examples such as

x=15
if (x/2)*2 == x:
   print 'Even'
else: print 'Odd'

I get an "invalid syntax" message and the single quote after even is highlighted.
On the video the professor is able to highlight this series of commands in a separate window and "run>>run module" (following a save request) with no problem. Each time I try,  I get the "invalid syntax" error. Similarly, in the Python Shell window, even if I try to do something simple such as
>>>print 'x'
I get "SyntaxError: invalid syntax" with the second quote highlighted as the offending item.

I request your help in determining if there's something I haven't done in downloading this program to my computer or if I need to be running a completely different version of python.

Thanks in advance.

Tim






More information about the docs mailing list