newbie problem with files...

Bjoern google at blinker.net
Mon May 27 14:27:29 EDT 2002


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")
fOut = open("double2.zip","wb")

chunk = fIn.read()
fOut.write(chunk)
fOut.flush()
fOut.close()
fIn.close()

where doublebuffer.zip is a 13Kb zipfile. double2.zip ends up a 1KB
file that isn't a valid zip-file...

Many thanks in advance for any pointers!


Bjoern



More information about the Python-list mailing list