Hi All, This afternoon I had some unexpected data corruption (thanks, GPFS!) which led me to find a very odd error. I don't know if this holds true for Enzo data anywhere, since it uses HDF5 and all, but to read Orion data we rely on numpy's fromfile() function. It turns out that if you seek past the end of a file, then call fromfile() on that filehandle, it throws a MemoryError. This makes very little sense from an end-user perspective. I was hunting through yt's source looking for some kind of memory related error until i realized the datafile might be corrupt. I can wrap the fromfile in a try/except statement to catch the MemoryError, but my question to you guys is, should I file a ticket upstream with the Numpy people? Or does this make sense and I am simply overlooking something? Here's the simplest test case that shows the behavior [jsoishi@volans ~]$ touch crap [jsoishi@volans ~]$ python -c 'import numpy; fi = open("crap"); fi.seek(100); numpy.fromfile(fi,count=10)' 10 items requested but only 0 read Traceback (most recent call last): File "<string>", line 1, in <module> MemoryError Any thoughts? j
Hi Jeff, I agree, that should return something else like IOError or FileError, or better yet, EOFError. I'd file a ticket, because at the very least it should be listed in the docstring: http://docs.scipy.org/doc/numpy/reference/generated/numpy.fromfile.html Best, Matt On Mon, Jun 21, 2010 at 4:32 PM, j s oishi <jsoishi@gmail.com> wrote:
participants (2)
-
j s oishi
-
Matthew Turk