Writing an image

Mr. Costington noahd at juno.no.spam.com
Fri Nov 7 12:40:11 EST 2003


"Alex Martelli" <aleax at aleax.it> wrote in message
news:pQPqb.107854$e5.3894406 at news1.tin.it...
> Michael Hudson wrote:
>
> > "Mr. Costington" <noahd at juno.no.spam.com> writes:
> >
> >> Hi all, I was trying to hava a CGI script return an image, but it was
>    ...
> > sys.stdout is not usually a binary-mode file.
>
> Right; one can change that with the -u switch to python (e.g., starting
> the cgi script with
>     #!c:\python23\python.exe -u
> if one's webserver recognizes and applies hashbang conventions).
>

Thanks.  My server ignores hashbangs, but I was able to set sys.stdout to
binary-mode with the following line:
msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)







More information about the Python-list mailing list