On 11/4/10 5:15 AM, Olli Sipilä wrote:
> 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
A Thursday 04 November 2010 13:37:33 Pauli Virtanen escrigué:
> Thu, 04 Nov 2010 13:33:48 +0100, Francesc Alted wrote:
> [clip]
>
> > To solve this, just apply byteswap once more:
> a = np.int32(300)
> a.byteswap().byteswap()
> >
> > 300
> >
> > and you are done.
>
> Or directly speci
Thu, 04 Nov 2010 13:33:48 +0100, Francesc Alted wrote:
[clip]
> To solve this, just apply byteswap once more:
>
a = np.int32(300)
a.byteswap().byteswap()
> 300
>
> and you are done.
Or directly specify big-endian byte order when reading
fromfile(fp, '>i4', 3)
A Thursday 04 November 2010 13:15:00 Olli Sipilä escrigué:
> 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"
On Thu, Nov 4, 2010 at 12:15 PM, Olli Sipilä 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". Howe