[Numpy-discussion] array.tofile() refuses to write into a StringIO

Pauli Virtanen pav at iki.fi
Sun Sep 25 17:33:10 EDT 2011


On 25.09.2011 18:23, OC wrote:
> as said in the subject, the following code produces an error. Is it normal ?
>
> **********************************************************
> A = r_[1]
> file_buffer = StringIO()
> A.tofile(file_buffer)
>
> IOError: first argument must be a string or open file
> **********************************************************

Yes, this is a known shortcoming of .tofile().

-- 
Pauli Virtanen




More information about the NumPy-Discussion mailing list