This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: Anything results in a SyntaxError after -u on 2.7.8 on Windows 7
Type: behavior Stage:
Components: Interpreter Core, Windows Versions: Python 2.7
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: Taylor.Marks
Priority: normal Keywords:

Created on 2014-10-03 20:39 by Taylor.Marks, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (4)
msg228373 - (view) Author: Taylor Marks (Taylor.Marks) Date: 2014-10-03 20:39
On Python 2.7.8, on Windows 7, if I start up the Python interactive console using the flags -i -u -c, nothing else will be considered valid syntax from that point forward.

My understanding is:

-i tells Python to enter interactive mode after it's done running whatever else it's told to do
-u tells Python to not buffer output
-c tells Python to treat any further arguments as Python code and to run it
None of these flags should be causing the issues that I'm seeing, I don't think.


$ python -i -u -c "print('Test')"
>>> print('verify')
  File "<stdin>", line 1
SyntaxError: invalid syntax

This doesn't occur on my computer running OS X Mavericks (10.9.4) and Python 2.7.6 which leads me to think this may be a platform or version specific issue...
msg228387 - (view) Author: Taylor Marks (Taylor.Marks) Date: 2014-10-03 21:29
I checked a few other combinations of flags:

-i -c works fine.
-u has the same issue as described in my opening message.

This occurs in both cmd and PowerShell, running as admin.
msg228388 - (view) Author: Taylor Marks (Taylor.Marks) Date: 2014-10-03 21:32
Sorry for multiple consecutive posts... I don't see a way to edit prior posts. The stack trace I posted in my first message has the arrow in the wrong spot. It should actually be pointing to the first space after the closing brace.

Here's a simpler (and correct) stack trace:

$ python -u
>>> print("Test")
  File "<stdin>", line 1
SyntaxError: invalid syntax
msg228390 - (view) Author: Taylor Marks (Taylor.Marks) Date: 2014-10-03 21:35
I found someone else describing the same behavior in 2.4 here, I guess the conclusion is it isn't a bug:
Date User Action Args
2022-04-11 14:58:08adminsetgithub: 66741
2014-10-03 21:35:08Taylor.Markssetstatus: open -> closed
resolution: not a bug
messages: + msg228390
2014-10-03 21:32:03Taylor.Markssetmessages: + msg228388
2014-10-03 21:29:26Taylor.Markssetmessages: + msg228387
title: Anything results in a SyntaxError after -i -u -c on 2.7.8 on Windows 7 -> Anything results in a SyntaxError after -u on 2.7.8 on Windows 7
2014-10-03 20:39:31Taylor.Markscreate