MySQLdb, blobs, and inserting
Ng Pheng Siong
ngps at madcap.dyn.ml.org
Thu Jan 13 09:49:36 EST 2000
According to Boudewijn Rempt <boud at rempt.xs4all.nl>:
> >>>> c.execute(r"INSERT INTO items (story) VALUES (%s)" % file )
>
> I haven't tried it - but wouldn't
> ...." % file.read() )
> work? I mean, are you trying to insert a file object or the contents
> of the file?
Assuming the original poster is trying to insert the content of the
file, try:
c.execute('insert into items (story) values ("%s") % file.read())
^^^^
Note this!
Cheers.
--
Ng Pheng Siong <ngps at post1.com> * http://www.post1.com/home/ngps
More information about the Python-list
mailing list