TypeError when writing .data with python 2.5.1
The following works fine with a python 2.4.3 installation, but with
2.5.1 I get:
In [1]:import numpy
In [2]:fid = file( '/tmp/tfile', 'w' )
In [3]:fid.write( numpy.zeros( 55 ).data )
---------------------------------------------------------------------------
<ipython console>(1)<module>()
I haven't tried it with python 2.5 Glen
On Fri, Apr 27, 2007 at 08:38:28AM -0500, Glen W. Mabey wrote:
The following works fine with a python 2.4.3 installation, but with 2.5.1 I get:
In [1]:import numpy
In [2]:fid = file( '/tmp/tfile', 'w' )
In [3]:fid.write( numpy.zeros( 55 ).data ) ---------------------------------------------------------------------------
Traceback (most recent call last) /home/gmabey/src/R9619_dev_acqlibweb/Projects/R9619_NChannelDetection/NED/<ipython console> in <module>()
: non-character (or 8-bit) array cannot be interpreted as character buffer <ipython console>(1)<module>()
I haven't tried it with python 2.5
Oh, and I'm using numpy from svn, updated this morning.
On 4/27/07, Glen W. Mabey
The following works fine with a python 2.4.3 installation, but with 2.5.1 I get:
In [1]:import numpy
In [2]:fid = file( '/tmp/tfile', 'w' )
In [3]:fid.write( numpy.zeros( 55 ).data )
---------------------------------------------------------------------------
Traceback (most recent call last) /home/gmabey/src/R9619_dev_acqlibweb/Projects/R9619_NChannelDetection/NED/<ipython console> in <module>()
: non-character (or 8-bit) array cannot be interpreted as character buffer <ipython console>(1)<module>()
Does In [1]: numpy.zeros(55).tofile('/tmp/tfile') work? Chuck
On Fri, Apr 27, 2007 at 07:52:16AM -0600, Charles R Harris wrote:
On 4/27/07, Glen W. Mabey
wrote: The following works fine with a python 2.4.3 installation, but with 2.5.1 I get:
In [1]:import numpy
In [2]:fid = file( '/tmp/tfile', 'w' )
In [3]:fid.write( numpy.zeros( 55 ).data )
---------------------------------------------------------------------------
Traceback (most recent call last) /home/gmabey/src/R9619_dev_acqlibweb/Projects/R9619_NChannelDetection/NED/<ipython console> in <module>()
: non-character (or 8-bit) array cannot be interpreted as character buffer <ipython console>(1)<module>()
Does
In [1]: numpy.zeros(55).tofile('/tmp/tfile')
work?
Yes! I was unaware of that method. Are the two equivalent? Also, I have identical results with python 2.5. I'm on AMD64-Linux, by the way. Thanks, Glen
participants (2)
-
Charles R Harris
-
Glen W. Mabey