Re: [Numpy-discussion] numpy.load raising IOError but EOFError expected

2010-07-01 Thread Ruben Salvador
Great! Thanks for all your answers! I actually have the files created as .npy (appending a new array eact time). I know it's weird, and it's not its intended use. But, for whatsoever reasons, I came to use that. No turn back now. Fortunately, I am able to read the files correctly, so being weird

Re: [Numpy-discussion] numpy.load raising IOError but EOFError expected

2010-07-01 Thread V. Armando Solé
Ruben Salvador wrote: Great! Thanks for all your answers! I actually have the files created as .npy (appending a new array eact time). I know it's weird, and it's not its intended use. But, for whatsoever reasons, I came to use that. No turn back now. Fortunately, I am able to read the

Re: [Numpy-discussion] numpy.load raising IOError but EOFError expected

2010-06-28 Thread Ruben Salvador
Sorry I had no access during these days. Thanks for the answer Friedrich, I had already checked numpy.savez, but unfortunately I cannot make use of it. I don't have all the data needed to be saved at the same time...it is produced each time I run a test. Thanks anyway! Any other idea why this

Re: [Numpy-discussion] numpy.load raising IOError but EOFError expected

2010-06-28 Thread Pauli Virtanen
ke, 2010-06-23 kello 12:46 +0200, Ruben Salvador kirjoitti: [clip] how can I detect the EOF to stop reading r = f.read(1) if not r: break # EOF else: f.seek(-1, 1) -- Pauli Virtanen ___ NumPy-Discussion mailing list

Re: [Numpy-discussion] numpy.load raising IOError but EOFError expected

2010-06-28 Thread Friedrich Romstedt
2010/6/28 Ruben Salvador rsalvador...@gmail.com: Thanks for the answer Friedrich, I had already checked numpy.savez, but unfortunately I cannot make use of it. I don't have all the data needed to be saved at the same time...it is produced each time I run a test. Yes, I thought of something

Re: [Numpy-discussion] numpy.load raising IOError but EOFError expected

2010-06-28 Thread Anne Archibald
On 28 June 2010 10:52, Ruben Salvador rsalvador...@gmail.com wrote: Sorry I had no access during these days. Thanks for the answer Friedrich, I had already checked numpy.savez, but unfortunately I cannot make use of it. I don't have all the data needed to be saved at the same time...it is

Re: [Numpy-discussion] numpy.load raising IOError but EOFError expected

2010-06-28 Thread Pauli Virtanen
ma, 2010-06-28 kello 15:48 -0400, Anne Archibald kirjoitti: [clip] That said, good exception hygiene argues that np.load should throw EOFErrors rather than the more generic IOErrors, but I don't know how difficult this would be to achieve. np.load is in any case unhygienic, since it tries to

Re: [Numpy-discussion] numpy.load raising IOError but EOFError expected

2010-06-28 Thread Keith Goodman
On Wed, Jun 23, 2010 at 3:46 AM, Ruben Salvador rsalvador...@gmail.com wrote: Hi there, I have a .npy file built by succesively adding results from different test runs of an algorithm. Each time it's run, I save a numpy.array using numpy.save as follows: fn = 'file.npy' f = open(fn, 'a+b')

Re: [Numpy-discussion] numpy.load raising IOError but EOFError expected

2010-06-28 Thread Friedrich Romstedt
2010/6/28 Keith Goodman kwgood...@gmail.com: How about using h5py? It's not part of numpy but it gives you a dictionary-like interface to your archive: Yeaa, or PyTables (is that equivalent)? It's also a hdf (or whatever, I don't recall precisely) interface. There were [ANN]s on the list

Re: [Numpy-discussion] numpy.load raising IOError but EOFError expected

2010-06-24 Thread Friedrich Romstedt
2010/6/23 Ruben Salvador rsalvador...@gmail.com: Therefore, is this a bug? Shouldn't EOFError be raised instead of IOError? Or am I missunderstanding something? If this is not a bug, how can I detect the EOF to stop reading (I expect a way for this to work without tweaking the code with saving

[Numpy-discussion] numpy.load raising IOError but EOFError expected

2010-06-23 Thread Ruben Salvador
Hi there, I have a .npy file built by succesively adding results from different test runs of an algorithm. Each time it's run, I save a numpy.array using numpy.save as follows: fn = 'file.npy' f = open(fn, 'a+b') np.save(f, arr) f.close() When I try to read the file with the following code, for

Re: [Numpy-discussion] numpy.load raising IOError but EOFError expected

2010-06-23 Thread Ruben Salvador
Sorry, I forgot to include versions info: Python 2.5.5 Numpy Version: 1:1.3.0-3+b1 (actual debian testing) On Wed, Jun 23, 2010 at 12:46 PM, Ruben Salvador rsalvador...@gmail.comwrote: Hi there, I have a .npy file built by succesively adding results from different test runs of an algorithm.