New submission from Armin Ronacher: I'm trying to write some code that fixes a misconfigured sys.stdin on a case by case bases but unfortunately I cannot use TextIOWrapper for this because it always closes the underlying file:
Python >>> import io >>> sys.stdin.encoding 'ANSI_X3.4-1968' >>> stdin = sys.stdin >>> correct_stdin = io.TextIOWrapper(stdin.buffer, 'utf-8') >>> correct_stdin.readline() foobar 'foobar\n' >>> del correct_stdin >>> stdin.readline() Traceback (most recent call last): File "<stdin>", line 1, in <module> ValueError: I/O operation on closed file. Ideally there would be a way to disable this behavior. ---------- messages: 217260 nosy: aronacher priority: normal severity: normal status: open title: io.TextIOWrapper always closes wrapped files _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue21363> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com