I left the Subject field with the wrong question. The immediate answer is “it presents the ‘file’ interface”. The consequent questions remain:
Ben Finney <ben+pyt...@benfinney.id.au> writes: > $ python2 […] > >>> gnupg_stdout = io.TextIOWrapper(gnupg_subprocess.stdout) > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > AttributeError: 'file' object has no attribute 'readable' > > I'm trying to write code that, as far as practicable, works unchanged > on Python 2 and Python 3. > > How do I wrap an arbitrary byte stream – already opened, such as a > ‘Popen.stdout’ attribute – in a text wrapper with a particular > encoding? It appears the Python 2 ‘file’ type doesn't implement a “buffer” as expected by ‘io.TextIOWrapper’. So how do I get from a Python 2 ‘file’ object, to whatever ‘io.TextIOWrapper’ wants? -- \ “Nature is trying very hard to make us succeed, but nature does | `\ not depend on us. We are not the only experiment.” —Richard | _o__) Buckminster Fuller, 1978-04-30 | Ben Finney -- https://mail.python.org/mailman/listinfo/python-list