Update: The PC seems to not be a factor (same problem exist on two PCs).
The entire script does some computation and writes depstats.txt. The code snippet below attempts to read depstats.txt and write another file. When the code below is run stand-alone, it succeeds. When run in-line as part of the program that wrote depstats.txt, there are three possible outcomes: it stops reading after 4096 bytes (not counting \r's); no error messages it stops reading after 8192 bytes (not counting \r's); no error messages or it succeeds. The first two are much more likely. Trying buffersize parameters of -1, 0, 1, 1000, 8192, 16384 in the open call for m all had no apparent effect. Any ideas what could possibly be wrong earlier to cause this? m = open("depstats.txt", "r", 20000) n = open("newds.txt", "w") linesout = 0 bytes = 0 for line in m: bytes += len(line) print len(line), len(line.split()), bytes t = line.split() if len(t) < 13: print "not enough fields, only", len(t) print t sys.exit() while len(t) < 43: t.append(0) t.append("F2") t = [str(x) for x in t] print >> n, " ".join(t) linesout += 1 print "linesout", linesout m.close() n.close() On Jul 6, 12:48 pm, Gerry <[EMAIL PROTECTED]> wrote: > 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 -- http://mail.python.org/mailman/listinfo/python-list