New submission from TaoQingyun <845767...@qq.com>: ``` >>> import json >>> f = open('/tmp/t.json', 'wb') >>> json.dump(123, f) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/python3.6/json/__init__.py", line 180, in dump fp.write(chunk) TypeError: a bytes-like object is required, not 'str' ```
This may not a bug. But it should mention at docs https://docs.python.org/3/library/json.html#json.dump ---------- components: Library (Lib) messages: 308517 nosy: qingyunha priority: normal severity: normal status: open title: json.dump: fp must be a text file object versions: Python 3.6 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue32358> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com