newbie problem with files...

Bjorn Pettersen BPettersen at NAREX.com
Mon May 27 14:45:21 EDT 2002


> From: Bjoern [mailto:google at blinker.net] 
> 
> Hello,
> 
> I can't seem to read complete files, they are usually cropped 
> after 1Kb or so. I've tried with file upload in cgi, but also 
> reading files from disk directly and writing them to another file.
> 
> The only thing I could imagine is that it has to do with the 
> description of read():
> 
> "For certain files, like ttys, it makes sense to continue 
> reading after an EOF is hit."
> 
> I don't know what a ttys is - so how would I know when to 
> continue reading after an EOF, and how would I then know when to stop?
> 
> My current testcode goes like this
> 
> fIn = open("doublebuffer.zip","r")

[snip]

You need to open it for binary read, so instead of "r" in the line above
put "rb".

-- bjorn





More information about the Python-list mailing list