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

Nils Wagner scipy-user@scipy.net
Thu, 20 Feb 2003 14:52:43 +0100


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