Replace old raise form

This commit is contained in:
Neil
2011-07-16 16:39:33 +02:00
parent 1a48914811
commit 26402a7e67
2 changed files with 5 additions and 5 deletions
+3 -3
View File
@@ -95,9 +95,9 @@ def convert_colorspace(arr, fromspace, tospace):
fromspace = fromspace.upper()
tospace = tospace.upper()
if not fromspace in fromdict.keys():
raise ValueError, 'fromspace needs to be one of %s'%fromdict.keys()
raise ValueError('fromspace needs to be one of %s'%fromdict.keys())
if not tospace in todict.keys():
raise ValueError, 'tospace needs to be one of %s'%todict.keys()
raise ValueError('tospace needs to be one of %s'%todict.keys())
return todict[tospace](fromdict[fromspace](arr))
@@ -108,7 +108,7 @@ def _prepare_colorarray(arr, dtype=np.float32):
if arr.ndim != 3 or arr.shape[2] != 3:
msg = "the input array must be have a shape == (.,.,3))"
raise ValueError, msg
raise ValueError(msg)
return arr.astype(dtype)
+2 -2
View File
@@ -128,7 +128,7 @@ class MultiImage(object):
if -numframes <= n < numframes:
n = n % numframes
else:
raise IndexError, "There are only %s frames in the image"%numframes
raise IndexError("There are only %s frames in the image"%numframes)
if self.conserve_memory:
if not self._cached == n:
@@ -289,7 +289,7 @@ class ImageCollection(object):
if -num <= n < num:
n = n % num
else:
raise IndexError, "There are only %s images in the collection"%num
raise IndexError("There are only %s images in the collection"%num)
return n
def __iter__(self):