Problem Displaying Pics

Victor Subervi victorsubervi at gmail.com
Tue Oct 6 15:37:17 EDT 2009


I remember going round and round on this issue before until I finally got it
right. I haven't changed the code. It worked before. I just tried your
update and it gave me the same result :( Any other ideas?
TIA,
V

On Tue, Oct 6, 2009 at 2:24 PM, Rami Chowdhury <rami.chowdhury at gmail.com>wrote:

> On Tue, 06 Oct 2009 12:19:56 -0700, Victor Subervi <
> victorsubervi at gmail.com> wrote:
>
>  Hi;
>> I have the following archaic code that worked just fine for another site.
>> It
>> is called with the following url:
>>
>> http://13gems.com/stxresort/cart/getpic1.py?id=1&x=1
>>
>> #!/usr/local/bin/python
>> import cgitb; cgitb.enable()
>> import MySQLdb
>> import cgi
>> import sys,os
>> sys.path.append(os.getcwd())
>> from login import login
>> user, passwd, db, host = login()
>> form = cgi.FieldStorage()
>> picid = int(form['id'].value)
>> x = int(form['x'].value)
>> pics = {1:'pic1',2:'pic2',3:'pic3',4:'pic4',5:'pic5',6:'pic6'}
>> pic = pics[x]
>> print 'Content-Type: text/html'
>>
>
> ^^^ I believe this is the problem line. It's telling the browser to expect
> HTML, not an image. Remove this, and the later Content-Type header that's
> being printed ("Content-Type: image/jpeg") should take effect.
>
>
> --
> Rami Chowdhury
> "Never attribute to malice that which can be attributed to stupidity" --
> Hanlon's Razor
> 408-597-7068 (US) / 07875-841-046 (UK) / 0189-245544 (BD)
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20091006/54ab458d/attachment.html>


More information about the Python-list mailing list