Serhiy Storchaka added the comment: I think it is worth to improve the error message in the write() method of binary files.
>>> sys.stdout.write(b'') Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: write() argument must be str, not bytes >>> sys.stdout.buffer.write('') Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: a bytes-like object is required, not 'str' >>> sys.stdout.buffer.raw.write('') Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: a bytes-like object is required, not 'str' But this is large issue. Other file-like objects (GzipFile, ZipExtFile etc) should be updated too. ---------- nosy: +serhiy.storchaka type: behavior -> enhancement versions: +Python 3.7 -Python 3.5 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue24159> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com