Never mind. Apparently, these tags throw it for that loop: print '<html><body>\n' I´m surprised they would, but gratified I found the problem. Victor
On Thu, Apr 17, 2008 at 9:42 AM, Victor Subervi <[EMAIL PROTECTED]> wrote: > Hi again: > Here is my code, an edit of Gabriel´s: > > #!/usr/local/bin/python > import cgitb; cgitb.enable() > import MySQLdb > def test(): > host = 'host' > db = 'db' > user = 'user' > passwd = 'pass' > db = MySQLdb.connect(host=host, user=user, passwd=passwd, db=db) > cursor= db.cursor() > cursor.execute('select pic1 from products where id="2";') > content = cursor.fetchall()[0][0].tostring() > f = open("somefile.jpg", "w") > f.write(content) > f.close() > print 'Content-Type: image/jpeg\r\nContent-Length: %d\n' % len(content) > print '<html><body>\n' > print content > print '</body><html>\n' > cursor.close() > > test() > Now, when I surf to the url of this script, it prints out garbage that is > a literal of the image, but not the image itself. However, if I surf to > ¨somefile.jpg¨, I see the image!! Am I losing my mind?? What´s wrong here? > TIA, > Victor >
-- http://mail.python.org/mailman/listinfo/python-list