Skip to content

Commit

Permalink
COMP: PEP 8: E722 do not use bare 'except'
Browse files Browse the repository at this point in the history
  • Loading branch information
hjmjohnson committed Oct 19, 2020
1 parent 5b5d79c commit c7fb93c
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions Wrapping/Generators/Python/itkTemplate.py
Expand Up @@ -340,11 +340,11 @@ def __getitem__(self, parameters):

try:
return self.__template__[tuple(cleanParameters)]
except:
except KeyError:
self._LoadModules()
try:
return self.__template__[tuple(cleanParameters)]
except:
except KeyError:
raise TemplateTypeError(self, tuple(cleanParameters))

def __repr__(self):
Expand Down Expand Up @@ -793,12 +793,15 @@ def progress():
callback(name, self.GetProgress())

self.AddObserver(itk.ProgressEvent(), progress)
except:
# it seems that something goes wrong...
except AttributeError:
# as this feature is designed for prototyping, it's not really a
# problem if an object doesn't have progress reporter, so adding
# reporter can silently fail
pass
except Exception:
# it seems that something else has gone wrong...
# silently fail to maintain backward compatibility
pass

if itkConfig.NotInPlace and "SetInPlace" in dir(self):
self.SetInPlace(False)
Expand Down

0 comments on commit c7fb93c

Please sign in to comment.