I have tried to follow this example to save a base64 encoded image I receive in a HTTP request, to the filesystem:
imgData = re.sub('^data:image/.+;base64,', '', inner_data['output']['image'])
with open("imageToSave.png", "wb") as fh:
fh.write(base64.decodestring(imgData))
I have printed the string I'm trying to decode and it seems to be correct.
/9j/4AAQSkZJRgABAQAAAQABAAD/ [...] /+bax2njPQ8daytViRZP7UQbbmGRVEg6sPf1qYK0bCnKzuf/Z
But I keep getting this error
TypeError: expected bytes-like object, not str