[SciPy-user] array TypeError: expected a readable buffer object

Robert Kern robert.kern@gmail....
Thu Sep 27 14:59:02 CDT 2007


BORGULYA Gábor wrote:
> Hi List!
> 
> Could someone explain me why I get an error message for the first 
> expression and why no error for the second?
> 
> In [1]: import scipy
> 
> In [2]: a = scipy.array(['1','2','3',None,'4','5'])
> ---------------------------------------------------------------------------
> exceptions.TypeError                                 Traceback (most recent 
> call last)
> 
> /home/gab/<console>
> 
> TypeError: expected a readable buffer object
> 
> In [3]: a = scipy.array([1,2,3,None,4,5])
> 
> In [4]: a
> Out[4]: array([1, 2, 3, None, 4, 5], dtype=object)
> 
> I expected that the first expression would evaluate as
> array(['1', '2', '3', None, '4', '5'], dtype=object)
> but it did not.

What version of numpy are you using? With numpy 1.0.3 and a recent SVN checkout,
it works for me.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco


More information about the SciPy-user mailing list