Python Interactive Interpreter always returns "Invalid syntax" on Windows

Posted by user559217 on Stack Overflow See other posts from Stack Overflow or by user559217
Published on 2010-12-31T11:37:42Z Indexed on 2011/01/10 3:53 UTC
Read the original article Hit count: 219

Filed under:
|
|

I've encountered an extremely confusing problem. Whatever I type into the Python interpreter returns "Invalid Syntax". See examples below. I've tried fooling around with the code page of the prompt I run the interpreter from, but it doesn't seem to help at all.

Furthermore, I haven't been able to find this particular, weird bug elsewhere online.

Any assistance anyone could provide would be lovely. I've already tried reinstalling Python, but I didn't have any luck - the problem is also there in both 3.13 and 2.7.

Running: Python version 3.1.3, Windows XP SP3.

Getting:

C:\Program Files\Python31>.\python
Python 3.1.3 (r313:86834, Nov 27 2010, 18:30:53) [MSC v.1500 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.  
>>> 2+2
  File "<stdin>", line 1  
    2+2
       ^     
SyntaxError: invalid syntax

>>> x = "Oh, fiddlesticks."  
  File "<stdin>", line 1  
    x = "Oh, fiddlesticks."  
                           ^  
SyntaxError: invalid syntax

© Stack Overflow or respective owner

Related posts about python

Related posts about Windows