[Numpy-discussion] atpy and readable buffer error

Tommy Grav tgrav at mac.com
Tue Apr 5 19:15:11 EDT 2011


I get this error that I do not understand. Does anyone know what is happening
and how to get around it

>>> import atpy
>>> t = atpy.Table()
>>> name = ["aa","bb","cc"]
>>> t.add_column("name",name)
>>> k = [1,2,3]
>>> t.add_column("num",k)
>>> t
<Table name='None' rows=3 fields=2>
>>> name = ["aaa","bbb","ccc"]
>>> p = atpy.Table()
>>> p.add_column("name",name)
>>> p.add_column("num",k)
>>> t.append(p)
Traceback (most recent call last):
 File "<stdin>", line 1, in <module>
 File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/atpy/basetable.py", line 301, in append
   raise Exception("Columns do not match")
Exception: Columns do not match
>>> nn = t.name.astype("|S3")
>>> t.remove_columns("name")
>>> t.add_column("name",nn)
>>> t.append(p)
Traceback (most recent call last):
 File "<stdin>", line 1, in <module>
 File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/atpy/basetable.py", line 302, in append
   self.data = np.hstack((self.data, table.data))
 File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/core/shape_base.py", line 258, in hstack
   return _nx.concatenate(map(atleast_1d,tup),1)
TypeError: expected a readable buffer object
>>> 

Cheers
  Tommy



More information about the NumPy-Discussion mailing list