I have come to the conclusion that this has absolutely nothing to do with the code. The problem is eNom. I have had so many problems with this provider specifically concerning their python interpreter that I actually filed a complaint against them with the BBB, which they still didn't resolve. Now that I'm back in the states and making money, I've bought space on another server that I'm building. Let me spend my time building that, and I believe all these silly problems will go away. I will start a new thread if I'm wrong. Thank you all for your help!<br>
V<br><br><div class="gmail_quote">On Thu, Oct 8, 2009 at 11:43 AM, Gabriel Genellina <span dir="ltr"><<a href="mailto:gagsl-py2@yahoo.com.ar">gagsl-py2@yahoo.com.ar</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;">
En Thu, 08 Oct 2009 12:30:16 -0300, Victor Subervi <<a href="mailto:victorsubervi@gmail.com" target="_blank">victorsubervi@gmail.com</a>> escribió:<br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="im">
<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><br>
<br></div><div class="im">
On Wed, Oct 7, 2009 at 4:11 PM, Rami Chowdhury <<a href="mailto:rami.chowdhury@gmail.com" target="_blank">rami.chowdhury@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;">
On Wed, 07 Oct 2009 14:05:25 -0700, Victor Subervi <<br>
<a href="mailto:victorsubervi@gmail.com" target="_blank">victorsubervi@gmail.com</a>> wrote:<br>
<br>
print 'Content-Type: image/jpeg'<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
print 'Content-Encoding: base64'<br>
print<br>
print content.encode('base64')<br>
</blockquote></blockquote></div></blockquote>
<br>
Are you sure this is your actual code?<br>
<br>
py> import urllib<br>
py> data = urllib.urlopen("<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>").read()<br>
py> data[:30]<br>
'Content-Encoding: base64\n\n\n/9j'<br>
py> data[-30:]<br>
'XdjTJvaaF5fvfMVgbUM+gatZXFzb\n\n'<br>
<br>
1) The Content-Encoding line is taken as part of the response entity (the picture data), but should be part of the header. I bet you have a blank line after Content-Type.<br>
2) Note the \n\n at the end<br>
<br>
py> data = data[27:-2]<br>
py> decoded = data.decode("base64")<br>
py> open("test.jpg","wb").write(decoded)<br>
<br>
I tried to open test.jpg, but it's corrupt.<br>
<br>
py> len(decoded)<br>
65535<br>
py> decoded[:30]<br>
'\xff\xd8\xff\xe0\x00\x10JFIF\x00\x01\x02\x01\x00H\x00H\x00\x00\xff\xe1 \xadExif\x00\x00'<br>
<br>
Very suspicious file size... Looks like a jpeg image that was truncated at that size. See whether it is already corrupt in the database and repair it (you're using a data type large enough to hold the image, aren't you?)<br>
<br>
After fixing the database, you can omit the unnecesary base64 encoding; anyway I'd add a Content-Length header to avoid that spurious \n at the end.<br><font color="#888888">
<br>
-- <br></font><div><div></div><div class="h5">
Gabriel Genellina<br>
<br>
-- <br>
<a href="http://mail.python.org/mailman/listinfo/python-list" target="_blank">http://mail.python.org/mailman/listinfo/python-list</a><br>
</div></div></blockquote></div><br>