[SciPy-user] Bug in scipy.io.fread?

Paul Ray Paul.Ray at nrl.navy.mil
Thu Dec 29 09:22:38 CST 2005


Hi,

I've compiled scipy_core and scipy from the current (yesterday, Rev  
1502) svn versions.
I'm running Mac OS X 10.4.3, with a fink-installed python2.4.
The new scipy builds and installs just fine, and all the unit tests I  
tried worked fine.  However, I get a Bus Error from the following  
simple program:
===================================================
import scipy
import scipy.io

print 'Opening test.dat for writing'
outfile = open('test.dat', mode='wb')
a = scipy.arange(1024.0,dtype='f')
print 'Writing array'
scipy.io.fwrite(outfile, 1024, a, 'f')
print 'Closing file'
outfile.close()

print 'Opening test.dat for reading'
infile = open('test.dat', mode='rb')
print 'Reading chunk'
tmpchunk = scipy.io.fread(infile, 1024, 'f')
print 'Done :',tmpchunk[0:10]
===================================================

Here is the run:

> mcxr2 : 192>python2.4 freadtest.py
> Opening test.dat for writing
> Writing array
> Closing file
> Opening test.dat for reading
> Reading chunk
> Bus error

The written file looks fine...

> mcxr2 : 193>od -f test.dat |head
> 0000000     0.000000e+00    1.000000e+00    2.000000e+00     
> 3.000000e+00
> 0000020     4.000000e+00    5.000000e+00    6.000000e+00     
> 7.000000e+00
> 0000040     8.000000e+00    9.000000e+00    1.000000e+01     
> 1.100000e+01
> 0000060     1.200000e+01    1.300000e+01    1.400000e+01     
> 1.500000e+01
> 0000100     1.600000e+01    1.700000e+01    1.800000e+01     
> 1.900000e+01
> 0000120     2.000000e+01    2.100000e+01    2.200000e+01     
> 2.300000e+01
> 0000140     2.400000e+01    2.500000e+01    2.600000e+01     
> 2.700000e+01
> 0000160     2.800000e+01    2.900000e+01    3.000000e+01     
> 3.100000e+01
> 0000200     3.200000e+01    3.300000e+01    3.400000e+01     
> 3.500000e+01
> 0000220     3.600000e+01    3.700000e+01    3.800000e+01     
> 3.900000e+01


Cheers,

-- Paul

--
Dr. Paul S. Ray              E-mail: Paul.Ray at nrl.navy.mil
Naval Research Laboratory    WWW   : http://xweb.nrl.navy.mil/ 
personnel/paulr/
Code 7655                    Phone : (202) 404-1619
Washington, DC 20375         AIM   : NRLPSR




More information about the SciPy-user mailing list