[SciPy-user] 'object_arrtype' problem

Ryan Krauss ryanlists at gmail.com
Thu Dec 8 09:45:04 CST 2005


I am having a problem very similar to one Chris Fonnesbeck was having
a few days ago.  I have a list of user defined objects.  I also want
to allow for the passing of a scalar to this particular function, so I
call atleast_1d on the list/scalar and then iterate over it.  After I
call atleast_1d, indexing the list returns object_arrtype.  One
interesting thing is that I have redefined __repr__ for this object,
and that method seems to be called correctly, but trying to access any
other property of the object causes messages like "*** AttributeError:
'object_arrtype' object has no attribute 'dof'".  Here is a pdb
session just before and after atleast_1d is called.  Is this a bug or
should I be doing this differently with new scipy (this code worked
fine with old scipy).


In [2]: run fortran_dev.py
> /home/ryan/rwkpython/TMM/__init__.py(292)__init__()
-> if bodeouts:
(Pdb) n
> /home/ryan/rwkpython/TMM/__init__.py(293)__init__()
-> bodeouts=atleast_1d(bodeouts)
(Pdb) type(bodeouts)
Out[2]: <type 'list'>
(Pdb) test=bodeouts[0]
(Pdb) type(test)
Out[2]: <type 'instance'>
(Pdb) test.dof
Out[2]: 0
(Pdb) test
Out[2]:
rwkbode.bodeout instance
dof=0
pind=None
input=Force in middle
ind=<TMM.beam.BeamElement instance at 0xb5d6258c>
output=L/2 position
post=
type=abs
(Pdb) n
> /home/ryan/rwkpython/TMM/__init__.py(294)__init__()
-> tempbo=[]
(Pdb) l
289                     self.bccols.append(ent)#in evaluating the
eigvalues, the columns of the system U matrix that multiply the
non-zero elements of the base state vector are the ones whose
sub-determinant must go to 0
290
291             pdb.set_trace()
292             if bodeouts:
293                 bodeouts=atleast_1d(bodeouts)
294  ->             tempbo=[]
295                 for cb in bodeouts:
296                     if type(cb)==dict:
297                         curtemp=rwkbode.bodeout(**cb)
298                         tempbo.append(curtemp)
299                     else:
(Pdb) type(bodeouts)
Out[2]: <type 'scipy.ndarray'>
(Pdb) test=bodeouts[0]
(Pdb) type(test)
Out[2]: <type 'object_arrtype'>
(Pdb) test
Out[2]:
rwkbode.bodeout instance
dof=0
pind=None
input=Force in middle
ind=<TMM.beam.BeamElement instance at 0xb5d6258c>
output=L/2 position
post=
type=abs
(Pdb) test.dof
*** AttributeError: 'object_arrtype' object has no attribute 'dof'
(Pdb)



Thanks,

Ryan



More information about the SciPy-user mailing list