the following code is throwing an error Error with file: string argument expected, got 'bytes'
I also tried using BytesIO but it threw an error about needed a format of string and not bytes. Very confusing.
def im_2_b64(image):
buffer = StringIO()
image.save(buffer, format="JPEG")
img_str = base64.b64encode(buffer.getvalue())
return img_str
How can I convert an image to base64 using python 2.7?
UPDATE
Error with file: Object of type bytes is not JSON serializable
Error with file: single positional indexer is out-of-bounds
using BytesIO