En Fri, 14 Dec 2007 12:19:41 -0300, Hans Müller <[EMAIL PROTECTED]> escribió:
> I cannot read a binary file into a mysql database. Everything I tried > did not succeed. > > What I tried (found from various google lookups...) is this: > > con = MySQLdb.connect(to server) > cur = con.cursor() > > cur.execute("insert into data values('file1', %s)", (open("test.jpg", > "rb").read(), )) Try wrapping the file contents with a Binary object (untested): data = MySQLdb.Binary(open("test.jpg","rb").read()) cur.execute("insert into data values('file1', %s)", (data,)) -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list