memory error

Heiko Wundram heikowu at ceosg.de
Wed Jun 2 15:19:47 CEST 2004


Am Mittwoch, 2. Juni 2004 15:11 schrieb Bart Nessux:
>           size = s.read()

You read the complete content of the file here. size will not contain the 
length of the file, but the complete file data. What you want is either 
len(s.read()) (which is sloooooooooow), or have a look at os.path.getsize().

>           size_list.append(size)

This appends the complete file to the list. And as such should explain the 
memory usage you're seeing...

HTH!

Heiko.




More information about the Python-list mailing list