[Numpy-discussion] Linux to Windows porting question

Robert Kern rkern at ucsd.edu
Tue Sep 6 11:50:05 CDT 2005


Daniel Sheltraw wrote:
> Hello NumPy Listees
> 
> I am trying to port some code to Windows that works fine under Linux.
> The offending line
> is:
> 
>     blk = fromstring(f_fid.read(BLOCK_LEN),
> num_type).byteswapped().astype(Float32).tostring()
> 
> The error I get is:
> 
>     ValueError: string size must be a multiple of element size
> 
> Does anyone have an idea where the problem might be? BLOCK_LEN is
> specified in bytes
> and num_type is Int32.

Is f_fid opened in binary mode?

  f_fid = open(filename, 'rb')

It should be.

-- 
Robert Kern
rkern at ucsd.edu

"In the fields of hell where the grass grows high
 Are the graves of dreams allowed to die."
  -- Richard Harter




More information about the Numpy-discussion mailing list