[Numpy-discussion] problem with a binary file on OS X 10.6

Peter numpy-discussion@maubp.freeserve.co...
Thu Nov 4 07:32:24 CDT 2010

On Thu, Nov 4, 2010 at 12:15 PM, Olli Sipilä <sippis99@hotmail.com> wrote:
> Hello,
> I have a problem reading a binary file on OS X 10.6. On my desktop mac (OS X
> 10.4.11, Python 2.5.4, Numpy 1.3.0), the command
> CELLS, NSIZE, NE = fromfile(fp, int32, 3), where fp is the filename,
> correctly prints "21 20 300". However, when I try the above on my laptop
> using Snow Leopard (Python 2.6.6, Numpy 1.5.0), I get the numbers "352321536
> 335544320 738263040". This results in a failure when trying to read the data
> that comes afterwards (Numpy fails with "array too big"). I assume this
> error may have something to do with 10.6 being 64-bit and 10.4 being 32-bit;
> however, the Python 2.6.6. distribution is also 32-bit. Any thoughts on
> this?
> Thanks,
> Olli Sipilä

Snow Leopard (10.6) is Intel only, so your laptop is using an Intel CPU
which is little-endian.

Is your Tiger (10.4) machine a PowerPC CPU? That would be big-endian,
and therefore would write the floats to disk reversed compared to what
a little-endian machine would expect.


More information about the NumPy-Discussion mailing list