diff --git a/mystic/abstract_solver.py b/mystic/abstract_solver.py index b4dbb3c..e6fe769 100755 --- a/mystic/abstract_solver.py +++ b/mystic/abstract_solver.py @@ -557,7 +557,7 @@ def SetMultinormalInitialPoints(self, mean, var=None): else: try: # scalar ? float(var) - except: # nope. var better be matrix of the right size (no check) + except (TypeError, ValueError): # nope. var better be matrix of the right size (no check) pass else: var = var * numpy.eye(self.nDim) diff --git a/mystic/constraints.py b/mystic/constraints.py index edcd616..aa68161 100644 --- a/mystic/constraints.py +++ b/mystic/constraints.py @@ -346,7 +346,7 @@ def issolution(constraints, guess, tol=1e-3): else: # is a constraints solver try: constrained = guess.copy() - except: + except AttributeError: from copy import deepcopy constrained = deepcopy(guess) error = 0.0 diff --git a/mystic/monitors.py b/mystic/monitors.py index a54daa6..c7dd2d0 100644 --- a/mystic/monitors.py +++ b/mystic/monitors.py @@ -640,7 +640,7 @@ def _load(path, monitor=None, verbose=False): #XXX: duplicate in mystic.munge? params = _globals['___params'] if '___params' in _globals else None cost = _globals['___cost'] if '___cost' in _globals else None del _globals - except: #XXX: should only catch the appropriate exceptions + except Exception: #XXX: should only catch the appropriate exceptions raise OSError("error reading '{path}'".format(path=path)) finally: