On 2023-06-20 02:15:00 +0900, Inada Naoki via Python-list wrote: > stream.flush() doesn't mean final output. > Try stream.close()
After close() the value isn't available any more: Python 3.11.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import io >>> buffer = io.BytesIO() >>> stream = io.TextIOWrapper(buffer, encoding='idna') >>> stream.write('abc.example.com') 15 >>> stream.close() >>> buffer.getvalue() Traceback (most recent call last): File "<stdin>", line 1, in <module> ValueError: I/O operation on closed file. hp -- _ | Peter J. Holzer | Story must make more sense than reality. |_|_) | | | | | h...@hjp.at | -- Charles Stross, "Creative writing __/ | http://www.hjp.at/ | challenge!"
signature.asc
Description: PGP signature
-- https://mail.python.org/mailman/listinfo/python-list