Python experts , please tell me about stdin

Drew Fisher drew at level3.net
Mon Aug 28 10:20:31 EDT 2000


Sindh wrote:

> Hi folks
>
>  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.
>
>  Your help would be appreciated.
>
>  Thanks
>  sreekant
> --

One thing you could try would be using the os module and the access
function.

You could test to see if the file is executable ...

if (os.access ( file, os.X_OK ):
    # binary file

or .... use os.stat ()

Drew






More information about the Python-list mailing list