[Numpy-discussion] fromfile and tofile access with a tempfile.TemporaryFile()

Tim Hirzel hirzel at resonon.com
Mon Dec 11 17:26:56 CST 2006


Hi,
Does anyone know how to get fromfile and tofile to work from a 
tempfile.TemporaryFile?  Or if its not possible?

I am getting this:
 >>> import tempfile
 >>> f = tempfile.TemporaryFile()
 >>> f
<open file '<fdopen>', mode 'w+b' at 0x01EE1728>
 >>> a = numpy.arange(10)
 >>> a.tofile(f)
Traceback (most recent call last):
  File "<input>", line 1, in ?
IOError: first argument must be a string or open file

thanks!
tim



More information about the Numpy-discussion mailing list