file reading anomaly

Gerry gerard.blais at gmail.com
Fri Jul 6 12:48:15 EDT 2007


Python 2.5, Windows XP.

I have a 48-line text file written by a Windows python script,

I try to read it as follows:



f       = open ("depstats.txt", "r", 0)
for index, line in enumerate(f):
    print index, len(line), len(line.split())
f.close()

On one PC, this runs without any problem.

On another, it appears to succeed (no run-time errors) but does not
read all the lines.  If I print the lines and sum of the line lengths
so far inside the loop, the program can be seen to have only read the
first N bytes, where N is either 4096, or 8192.

Any ideas?

Thanks,

Gerry




More information about the Python-list mailing list