Issue 707576: -i -u options give SyntaxError on Windows (original) (raw)

Created on 2003-03-21 15:52 by fresh, last changed 2022-04-10 16:07 by admin. This issue is now closed.

Messages (5)
msg15224 - (view) Author: Chris Withers (fresh) Date: 2003-03-21 15:52
C:\>python -i -u Python 2.2.2 (#37, Oct 14 2002, 17:02:34) [MSC 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> print 1 File "", line 1 print 1 ^ SyntaxError: invalid syntax >>> ...and this behaviour continues, no mater what statement you enter.
msg15225 - (view) Author: Tim Peters (tim.peters) * (Python committer) Date: 2003-03-21 16:30
Logged In: YES user_id=31435 Why do you call this a bug? -u forces stdin into binary mode, and the Python grammar does not allow \r\n line endings in program text (it never has, BTW). Program text has to come from a file opened in text mode on Windows, and what you're seeing here is the same as what you'd see if you did f = open('some_python_program.py', 'rb') exec f.read() on Windows.
msg15226 - (view) Author: Chris Withers (fresh) Date: 2003-03-26 17:05
Logged In: YES user_id=24723 -u : unbuffered binary stdout and stderr (also PYTHONUNBUFFERED=x) Hmmm... never noticed the binary bit before. Is there any way to get unbuffered output without it being binary?
msg15227 - (view) Author: Tim Peters (tim.peters) * (Python committer) Date: 2003-03-27 03:58
Logged In: YES user_id=31435 The only way on Windows is to open a file yourself in text mode with buffer size 0, and either write to it directly, or set sys.stdout to it.
msg15228 - (view) Author: Chris Withers (fresh) Date: 2003-03-30 23:59
Logged In: YES user_id=24723 OK :-)
History
Date User Action Args
2022-04-10 16:07:49 admin set github: 38195
2003-03-21 15:52:24 fresh create