Berker Peksag <berker.pek...@gmail.com> 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 anything to do with the json 
module and it's expected:

    >>> f = open('/tmp/t.json', 'wb')
    >>> f.write('foo')
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    TypeError: a bytes-like object is required, not 'str'

----------
nosy: +berker.peksag
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

_______________________________________
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

Reply via email to