[docs] [issue10976] json.loads() raises TypeError on bytes object

Hanxue Lee report at bugs.python.org
Fri Apr 4 17:23:44 CEST 2014


Hanxue Lee added the comment:

This seems to be an issue (bug?) for Python 3.3 When calling json.loads() with a byte array, this is the error

json.loads(response.data, 'latin-1')

TypeError: can't use a string pattern on a bytes-like object


When I decode the byte array to string

json.loads(response.data.decode(), 'latin-1')

I get this error

TypeError: bytes or integer address expected instead of str instance

----------
nosy: +Hanxue.Lee

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10976>
_______________________________________


More information about the docs mailing list