On Wed, Apr 9, 2008 at 1:49 PM, Steve Holden <[EMAIL PROTECTED]> wrote:

> Victor Subervi wrote:
> > On Wed, Apr 9, 2008 at 12:51 PM, Steve Holden <[EMAIL PROTECTED]
> > <mailto:[EMAIL PROTECTED]>> wrote:
> I imagine the following code should do so, given your earlier writings:
>
> #! /usr/bin/python
>
> import MySQLdb
>
> print "Content-type: image/jpeg\r\n"
> host = 'host'
> db = 'bre'
> user = 'user'
> passwd = 'pass'
> connection = MySQLdb.connect(host=host, user=user, passwd=passwd, db=db)
> cursor = connection.cursor()
> cursor.execute('select img from photo where id="7";')
> content = cursor.fetchall()[0][0]
> f = open("somefile.jpg", "w")
> f.write(content)
> f.close()
>
> Then see if you can deal with "somefile.jpg" like any other JPEG. If you
> can't then your blobs are somehow being mangled. If you can, we'll take
> it from there.


Yes, I can. Shows up in browser when surfed to, and it was pulled from the
database. No mangling. I am signing off, back tomorrow morning.
TIA,
Victor
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to