Ned Deily added the comment:
I think the issue here is that you are expecting the mode attribute of a file
object (or io.* object in Py3) to reflect the readable and writeable access
mode of the underlying file descriptor (for POSIX-like systems). But, as noted
in the documentation for the
Xiang Zhang added the comment:
Thanks for your reply Ned and it does solve my puzzle. It's my fault to
misunderstand the attribute and make noise here.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24073
New submission from Xiang Zhang:
The problem is what the title tells and can be produced by the snippet below.
import sys
import os
sys.stdout.write(%s\n % sys.stdin.mode)
sys.stdout.flush()
f = os.fdopen(sys.stdin.fileno(), r)
f.write()
f.flush()
f.read()
f.close()
When running this