July 29, 2010
3:50 a.m.
All, I'm trying to write numpy arrays as binary data, to support a legacy file format. So I open a file and write to it: fp = open('somefile','w') ... oldpos = fp.tell() somenumpyarray.tofile(fp) newpos = fp.tell() diff = newpos - oldpos - somenumpyarray.nbytes if diff != 0: print 'ahhah! mismatch=',diff ... I'm observing that every once in while I get 'ahhah! mismatch=1', that is, the file position is advanced by one more byte than x.nbytes would give. I'm using 1.4.1 on windows, python 2.5. Any ideas? Thanks, Paul Probert University of Wisconsin