[Yt-dev] (slightly off topic) a very strange error message from numpy

j s oishi jsoishi at gmail.com
Mon Jun 21 16:32:20 PDT 2010


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 at volans ~]$ touch crap
[jsoishi at 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



More information about the yt-dev mailing list