[issue32358] json.dump: fp must be a text file object

2018-03-23 Thread Berker Peksag
Berker Peksag added the comment: This is already documented in the json.dump() documentation: The json module always produces str objects, not bytes objects. Therefore, fp.write() must support str input. Note that the traceback you've posted doesn't have

[issue32358] json.dump: fp must be a text file object

2017-12-17 Thread TaoQingyun
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 "", line 1, in File "/usr/lib/python3.6/json/__init__.py", line 180, in dump