Python cgi script - outputting images

Erno Kuusela erno-news at erno.iki.fi
Sun Jul 1 13:38:00 EDT 2001


In article <5hmujt89383m9n4o044aknd2a0f5d5h0re at 4ax.com>, Mexican
Bandit <eli-wallach at ugly.com> writes:

| 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).

windows has separate "text mode" and "binary mode". text mode
means windows does some translation when you write to a file.
this breaks for binary data. stdout also happens to be in
text mode by default. you need to run python with the -u command
line option to get stdout in binary mode.

  -- erno




More information about the Python-list mailing list