[Numpy-discussion] how can one catch a multiarray.error

josef.pktd@gmai... josef.pktd@gmai...
Mon Jun 1 21:37:19 CDT 2009


how do we catch a multiarray.error in a try except clause?

e.g.
>>> np.argmin([])
Traceback (most recent call last):
  File "<pyshell#147>", line 1, in <module>
    np.argmin([])
  File "C:\Programs\Python25\Lib\site-packages\numpy\core\fromnumeric.py",
line 631, in argmin
    return _wrapit(a, 'argmin', axis)
  File "C:\Programs\Python25\Lib\site-packages\numpy\core\fromnumeric.py",
line 37, in _wrapit
    result = getattr(asarray(obj),method)(*args, **kwds)
multiarray.error: attempt to get argmax/argmin of an empty sequence

Josef


More information about the Numpy-discussion mailing list