Python; urllib error: AttributeError: 'bytes' object has no attribute 'read' Python; urllib error: AttributeError: 'bytes' object has no attribute 'read' python-3.x python-3.x

Python; urllib error: AttributeError: 'bytes' object has no attribute 'read'


Try this:

jsonResponse = json.loads(response.decode('utf-8'))


Use json.loads not json.load.

(load loads from a file-like object, loads from a string. So you could just as well omit the .read() call instead.)


I'm not familiar with python 3 yet, but it seems like urllib.request.urlopen().read() returns a byte object rather than string.

You might try to feed it into a StringIO object, or even do a str(response).