I took out the line in question (with text/html). Now it prints to screen the url. It did that before. Strange. Any other ideas?<br>TIA,<br>V<br><br><div class="gmail_quote">On Tue, Oct 6, 2009 at 3:40 PM, Rami Chowdhury <span dir="ltr"><<a href="mailto:rami.chowdhury@gmail.com">rami.chowdhury@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div></div><div class="h5">On Tue, 06 Oct 2009 13:26:19 -0700, Victor Subervi <<a href="mailto:victorsubervi@gmail.com" target="_blank">victorsubervi@gmail.com</a>> wrote:<br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
The code in question is generated automatically from another script. I took<br>
your idea of the \r\n\r\n and added triple quoting and now it prints out<br>
this:<br>
<br>
#!/usr/local/bin/python<br>
import cgitb; cgitb.enable()<br>
import MySQLdb<br>
import cgi<br>
import sys,os<br>
sys.path.append(os.getcwd())<br>
from login import login<br>
user, passwd, db, host = login()<br>
form = cgi.FieldStorage()<br>
picid = int(form['id'].value)<br>
x = int(form['x'].value)<br>
pics = {1:'pic1',2:'pic2',3:'pic3',4:'pic4',5:'pic5',6:'pic6'}<br>
pic = pics[x]<br>
print '''Content-Type: text/html<br>
<br>
'''<br>
db = MySQLdb.connect(host=host, user=user, passwd=passwd, db=db)<br>
cursor= db.cursor()<br>
sql = "select " + pic + " from products where id='" + str(picid) + "';"<br>
cursor.execute(sql)<br>
content = cursor.fetchall()[0][0].tostring()<br>
cursor.close()<br>
print '''Content-Type: image/jpeg<br>
<br>
'''<br>
print<br>
print content<br>
<br>
<br>
To answer your questions, I have no idea what eNom has done to their<br>
servers, which is where the other site was hosted (never went live), but am<br>
in the process of building on DreamHost, who seems to be a FAR better<br>
service than eNom, whom I actually had to report to the BBB and they never<br>
fixed or acknowledged very obvious problems. At any rate, the above code<br>
gets the browser to print out all the binary "garbage" that should translate<br>
into an image (you can look:<br>
<a href="http://13gems.com/stxresort/cart/getpic1.py?id=1&x=1" target="_blank">http://13gems.com/stxresort/cart/getpic1.py?id=1&x=1</a> ). Any more ideas would<br>
be helpful.<br>
</blockquote>
<br></div></div>
Going to that URL, my browser now tries to render an HTML page, and I can now see the 'Content-Type: image/jpeg' string being printed into the HTML source. Have you tried removing the 'Content-Type: text/html' header, with the new triple-quoted syntax?<div>
<div></div><div class="h5"><br>
<br>
-- <br>
Rami Chowdhury<br>
"Never attribute to malice that which can be attributed to stupidity" -- Hanlon's Razor<br>
408-597-7068 (US) / 07875-841-046 (UK) / 0189-245544 (BD)<br>
</div></div></blockquote></div><br>