[Numpy-discussion] comparing string array with None raises ValueError
Sebastian Haase
haase at msg.ucsf.edu
Thu Jun 24 10:07:10 CDT 2004
Hi,
I'm not sure if this is fixed already in CVS but here it goes:
I'm working with record arrays, and trying to access a field with
type '10a80' - that is, an array of 10 80 char 'strings' :
>>> q.Mrc.hdr = q.Mrc.hdrArray[0].field
>>> q.Mrc.hdr('title') != None
Traceback (most recent call last):
File "<input>", line 1, in ?
File "/jws30/haase/PrLin/numarray/strings.py", line 431, in __ne__
return self.StrCmp(other).__ne__(0)
File "/jws30/haase/PrLin/numarray/strings.py", line 385, in StrCmp
b = asarray(b0, kind=self.__class__)
File "/jws30/haase/PrLin/numarray/strings.py", line 1024, in asarray
return array(buffer, itemsize, shape, byteoffset, bytestride, kind)
File "/jws30/haase/PrLin/numarray/strings.py", line 994, in array
byteoffset=byteoffset, bytestride=bytestride)
File "/jws30/haase/PrLin/numarray/strings.py", line 84, in __init__
raise ValueError("Must define both shape & itemsize if buffer is None")
ValueError: Must define both shape & itemsize if buffer is None
>>>
>>> print q.Mrc.hdr('title')
['tit1e seb says hi' '' '' '' '' '' '' '' '' '']
>>>
Thanks for numarray ;-)
Sebastian Haase
More information about the Numpy-discussion
mailing list