[SciPy-dev] numpyio.io problem

Stephen Walton stephen.walton at csun.edu
Wed Oct 19 18:10:36 CDT 2005


My last Bug of the Day, which is also triggered by the first test in 
test_array_import.py, shows that numpyio.fwrite will not convert a real 
array to shorts before writing them out.  Note the last line succeeds in 
writing ints.  Is this new/old/desired behavior?

In [1]:import scipy
Importing io to scipy
Importing special to scipy
Importing utils to scipy
Importing interpolate to scipy
Importing optimize to scipy
Importing linalg to scipy

In [2]:import scipy.io.numpyio as numpyio

In [3]:a=255*scipy.rand(20)

In [4]:fid=open('foo','wb+')

In [5]:numpyio.fwrite(fid,20,a,'s')
---------------------------------------------------------------------------
exceptions.ValueError                                Traceback (most 
recent call last)

/home/swalton/<console>

ValueError: Invalid type for array

In [10]:numpyio.fwrite(fid,20,a,'i')




More information about the Scipy-dev mailing list