>> I don't see any sort of "fdopen" or "freopen" equivalent mentioned in the io >> module documentation. Is this possible in a clean way? >> > > There is an os.fdopen(), so maybe > > newf = os.fdopen(fp.fileno())
Correct, but that just returns another File object which will still lack the API provided by io.IOBase. I'm talking Python 2.7 here. In Python 3.x, all I/O is mediated by that API. Skip -- https://mail.python.org/mailman/listinfo/python-list