Python cgi script - outputting images

Steve Holden sholden at holdenweb.com
Sun Jul 1 16:10:56 EDT 2001


"Mexican Bandit" <eli-wallach at ugly.com> wrote in message
news:5hmujt89383m9n4o044aknd2a0f5d5h0re at 4ax.com...
> I tried using sys.stdout.write() but had the same problem.
>
> As different browsers give the same corrupted image, it must be my
> webserver (Xitami on Windows 98).
>
> Thanks for the replies.
>
I have served up images from both Xitami and Apache under Win 95/8, so I
don't think that Xitami is your problem. Try ensuring that your interpreter
runs with stdout set in binary mode by chaging your CGI program header into
something like

#!C:\Python20\python.exe -u

and you might find it works.

By the way, I'm assuming you have some sensible reason (like a firewall) why
your server has to read the image and write it out, rather than simply
returning the image's URL as the SRC attribute of the IMG tag?

regards
 STeve
--
http://www.holdenweb.com/








More information about the Python-list mailing list