Re: [Numpy-discussion] tofile problems

2010-07-29 Thread Paul Probert
On 07/28/2010 11:32 PM, Christopher Barker wrote: > Paul Probert wrote: >> 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

Re: [Numpy-discussion] tofile problems

2010-07-28 Thread Christopher Barker
Paul Probert wrote: >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.nbyte

[Numpy-discussion] tofile problems

2010-07-28 Thread Paul Probert
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!