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

2011-09-27 Thread oc-spam66
if you want to write to a string, why not use .tostring()? Because A.tostring() returns the binary data, while I would like the text representation. More precisely, I would like to use A.tofile(sep=\t). Yes, this is a known shortcoming of .tofile(). Is it worth filing a bug report ? --

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

2011-09-27 Thread oc-spam66
Ah, I found a workaround: savetxt() can work with a StringIO - savetxt(file_buffer, A) This is only a workaround. I still think A.tofile() should be capable of writing into a StringIO. -- O.C. ___ NumPy-Discussion mailing list

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

2011-09-27 Thread Chris.Barker
On 9/27/11 2:14 AM, oc-spam66 wrote: if you want to write to a string, why not use .tostring()? Because A.tostring() returns the binary data, while I would like the text representation. More precisely, I would like to use A.tofile(sep=\t). I see -- I've always thought mingling binary and

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

2011-09-25 Thread OC
Hello, 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

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

2011-09-25 Thread Pauli Virtanen
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