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

Chris.Barker Chris.Barker@noaa....
Sun Sep 25 18:57:01 CDT 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
>> **********************************************************

if you want to write to a string, why not use .tostring()?

-CHB


-- 
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker@noaa.gov


More information about the NumPy-Discussion mailing list