[issue17404] ValueError: can't have unbuffered text I/O for io.open(1, 'wt', 0)

2020-11-06 Thread Irit Katriel
Change by Irit Katriel : -- versions: +Python 3.10, Python 3.8, Python 3.9 -Python 2.7, Python 3.2, Python 3.3, Python 3.4 ___ Python tracker ___ _

[issue17404] ValueError: can't have unbuffered text I/O for io.open(1, 'wt', 0)

2018-12-29 Thread Martin Panter
Martin Panter added the comment: It is documented that buffering=0 is not supported in text mode. Look a handful of paragraphs down from : “Pass 0 to switch buffering off (only allowed in binary mode)” Amaury’s problem with t

[issue17404] ValueError: can't have unbuffered text I/O for io.open(1, 'wt', 0)

2013-03-13 Thread Antoine Pitrou
Antoine Pitrou added the comment: > > - it won't work for reading: TextIOWrapper calls the read1() > > method, which is only defined by BufferedIO objects. > > Since 3.3 TextIOWrapper works with raw IO objects (issue12591). It won't be technically unbuffered, though. -- title: ValueErr

[issue17404] ValueError: can't have unbuffered text I/O for io.open(1, 'wt', 0)

2013-03-13 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: > - it won't work for reading: TextIOWrapper calls the read1() method, which is > only defined by BufferedIO objects. Since 3.3 TextIOWrapper works with raw IO objects (issue12591). > Yes. And I just noticed that the _io module (the C version) will also buff

[issue17404] ValueError: can't have unbuffered text I/O for io.open(1, 'wt', 0)

2013-03-12 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc added the comment: > But that will still be within the TextIOWrapper itself, right? Yes. And I just noticed that the _io module (the C version) will also buffer encoded bytes, up to f._CHUNK_SIZE. On the other hand, TextIOWrapper is broken for buffering codecs, encode() is

[issue17404] ValueError: can't have unbuffered text I/O for io.open(1, 'wt', 0)

2013-03-12 Thread Robert Collins
Robert Collins added the comment: Huh, I didn't realise idna would retain data! But that will still be within the TextIOWrapper itself, right? And a stream opened 'wt' cannot be read from anyway, so the read1 limitation is irrelevant. -- ___ Python

[issue17404] ValueError: can't have unbuffered text I/O for io.open(1, 'wt', 0)

2013-03-12 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc added the comment: The proposed workaround seems to work ("wb" instead of "wt"!), with the following restrictions: - it's not really unbuffered: the encoder has its own buffers (OK, in the stdlib only 'idna' encoding will retain data) - it won't work for reading: TextIOWr

[issue17404] ValueError: can't have unbuffered text I/O for io.open(1, 'wt', 0)

2013-03-12 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- components: +IO nosy: +benjamin.peterson, hynek, pitrou, stutzbach versions: -Python 2.6, Python 3.1, Python 3.5 ___ Python tracker ___

[issue17404] ValueError: can't have unbuffered text I/O for io.open(1, 'wt', 0)

2013-03-12 Thread Robert Collins
New submission from Robert Collins: The io library rejects unbuffered text I/O, but this is not documented - and in fact can be manually worked around: binstdout = io.open(sys.stdout.fileno(), 'wt', 0) sys.stdout = io.TextIOWrapper(binstdout, encoding=sys.stdout.encoding) will get a sys.