I want to display a picture I already saved on the table img, but it gives me an error
cannot identify image file
When it try to open the file_like.
Cursor and connection use the connection and password to mysql database.
With the following code I wanted to display the picture. What's wrong with it, or is there even a better/easier way?
sql1='select * from img'
connection.commit()
cursor.execute(sql1)
data2=cursor.fetchall()
file_like=cStringIO.StringIO(data2[0][0])
img1=PIL.Image.open(file_like,mode='r').convert('RGB')
img1.show()
cursor.close()