[SciPy-User] weird TypeError: only length-1 arrays can be converted to Python scalars
Wolfgang Kerzendorf
wkerzendorf at googlemail.com
Wed May 25 22:27:09 EDT 2011
Dear all,
I have come across a weird error, in which the traceback doesn't really
reflect the problem (ah osx 10.6.7, python2.6, np 1.6, sp 0.9, ipython
0.10.1, mpl 1.0.1):
----
File "weird_error.py", line 8, in <module>
fmin.simplex()
File "/Users/wkerzend/scripts/python/pyspecgrid/specgrid.py", line
134, in __call__
gridSpec = self.specGrid.getSpec(*args)
File "/Users/wkerzend/scripts/python/pyspecgrid/specgrid.py", line
235, in getSpec
return oned.onedspec(self.wave, self.interpGrid(args), mode='waveflux')
File "interpnd.pyx", line 120, in
interpnd.NDInterpolatorBase.__call__ (scipy/interpolate/interpnd.c:1896)
File "interpnd.pyx", line 142, in interpnd._ndim_coords_from_arrays
(scipy/interpolate/interpnd.c:2145)
File "/Library/Python/2.6/site-packages/numpy/lib/stride_tricks.py",
line 69, in broadcast_arrays
args = map(np.asarray, args)
File "/Library/Python/2.6/site-packages/numpy/core/numeric.py", line
235, in asarray
return array(a, dtype, copy=False, order=order)
TypeError: only length-1 arrays can be converted to Python scalars
------
I have debugged it here:
--> 235 return array(a, dtype, copy=False, order=order)
236
ipdb> a
a = 0.1
dtype = None
order = None
ipdb> type(a)
<type 'float'>
----------------
It just doesn't make sense to me, please help,
Wolfgang
More information about the SciPy-User
mailing list