How to designate sys.stdout for binary output in win32?

Alex Martelli aleax at aleax.it
Mon May 5 03:45:24 EDT 2003


zERo wrote:
   ...
> appropriate html headers, I could use it as a CGI app and have it
> display directly in a browser.  Thus, the requirement of 'binary'
> output to sys.stdout, so the browser can act upon it.

The -u switch to the Python interpreter often helps here.  E.g.,

#!C:\Python22\Python.exe -u

as the first line of a CGI script meant to write binary data to
sys.stdout and run under xitami or other webserver implementing
the shebang convention for CGIs under Windows.


Alex





More information about the Python-list mailing list