[SciPy-user] ValueError: I/O operation on closed file

Nils Wagner nwagner at mecha.uni-stuttgart.de
Thu Feb 20 08:52:43 EST 2003


Hi all,

I guess there is a bug in io.write_array.
When I try to write an array to a file several times I get the following
message

Traceback (most recent call last):
  File "iotest.py", line 6, in ?
    io.write_array(file,A,separator=' ',linesep='\n',
precision=5,suppress_small=1)
  File
"/usr/local/lib/python2.1/site-packages/scipy/io/array_import.py", line
428, in write_array
    file.write(astr)
ValueError: I/O operation on closed file

from scipy import io
from scipy import *
file = open("test.dat",'w')
A = array(([1.0,0.0],[0.0,1.0]))
io.write_array(file,A,separator=' ',linesep='\n',
precision=5,suppress_small=1)
io.write_array(file,A,separator=' ',linesep='\n',
precision=5,suppress_small=1)


Any idea ?

                Nils



More information about the SciPy-User mailing list