A
Alex van der Spek
I do not understand why the spooled write gives an error. See below.
The normal tempfile works just fine. They are supposed to behave equal?
All insight you can provide is welcome.
Alex van der Spek
+++++++++++++++++++++++++++++++++++++++++++++++++
Python 2.7.1 (r271:86832, Nov 27 2010, 18:30:46) [MSC v.1500 32 bit (Intel)]
on win32
Type "copyright", "credits" or "license()" for more information.
Traceback (most recent call last):
File "<pyshell#7>", line 1, in <module>
stf.write(ffa)
File "C:\Python27\lib\tempfile.py", line 595, in write
rv = file.write(s)
TypeError: must be string or read-only character buffer, not array.array
The normal tempfile works just fine. They are supposed to behave equal?
All insight you can provide is welcome.
Alex van der Spek
+++++++++++++++++++++++++++++++++++++++++++++++++
Python 2.7.1 (r271:86832, Nov 27 2010, 18:30:46) [MSC v.1500 32 bit (Intel)]
on win32
Type "copyright", "credits" or "license()" for more information.
import array
import tempfile
stf = tempfile.SpooledTemporaryFile(max_size=1024)
ptf = tempfile.TemporaryFile()
fff = [float(x) for x in range(2048)]
ffa = array.array('f',fff)
ptf.write(ffa)
stf.write(ffa)
Traceback (most recent call last):
File "<pyshell#7>", line 1, in <module>
stf.write(ffa)
File "C:\Python27\lib\tempfile.py", line 595, in write
rv = file.write(s)
TypeError: must be string or read-only character buffer, not array.array