StringIO vs array.tofile() ?

Martin v. Löwis loewis at informatik.hu-berlin.de
Wed Apr 24 04:23:28 EDT 2002


jaf <jaf at lcsaudio.com> writes:

> Hi all,
> 
> Why is that?  Isn't a StringIO a valid "open file"?

The array's tofile method requires a file object (i.e. an object whose
type is types.FileType); a StringIO object is only "file-like".

Since this limitation is documented (it says file, not file-like),
this is a bug in your code. I recommend to use the .tostring method
instead.

Regards,
Martin




More information about the Python-list mailing list