MySQL Forums
Forum List  »  Connector/Python

Storing a picture on db with python
Posted by: Damien LEFEVRE
Date: February 15, 2006 06:26AM

My problem is the following: I'd like to store a picture on a database (bd2) in a BLOB field using python.
I've already SQL for python and all the python environment installed.

I've tried already by opening the picture (PIL module), read it as a string and then inserting the string in my query.

It has kind of worked with one picture (PNG), but damaged a line of pixel, I can't find the reason for that.

With anoher picture I get syntax error:

_mysql_exceptions.ProgrammingError: (1064, 'You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near \'\xff\xf7\x8f\'\xff\xff\x94(\xff\xe4\x82"\xf4;\x1f\x06\xa8\' at line 1')

but it doesn't help my so much.

Maybe I'm not doing it in a right way. If anybody has an idea for me please send it.



Options: ReplyQuote

Written By
Storing a picture on db with python
February 15, 2006 06:26AM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.