No one wants to answer !!!

Terry Reedy tjreedy at udel.edu
Sun Aug 27 01:23:24 EDT 2000


"Sindh" <skodela at my-deja.com> wrote
> Still awaiting for the kind soul who can / will answer this !
> >
> >  I am using oython for my cgi dev. I wrote a page with a few file
> upload
> > buttons. When I try to submit files , the cgi script
> >  reads the files ok as long as they are not binary. If they are binary
> > it waits for ever. Somewhere, on thin news group I read
> >  that I have to change stdin to bainary mode but the python
> > documentation does not give any clues.
> >
> >  So how do yuo set stdin to binary.

The file mode is set when you open it -- in Python open(), it is the second
parameter.  Check reference for details.

Since stdin is already open, I am not sure you can change mode.

The only difference that I know of between binary and text mode is that on
Windows (but not *nix) text mode causes \r\n to be condensed to or expanded
from \n on input and output.  Do not know about Mac.

A specific example, as short as possible, of files that work and do not,
with code and error messages, might get a more specific response.

TJR






More information about the Python-list mailing list