diff --git a/pypesto/optimize/optimizer.py b/pypesto/optimize/optimizer.py index 6bd689fcc..9060f3434 100644 --- a/pypesto/optimize/optimizer.py +++ b/pypesto/optimize/optimizer.py @@ -1337,11 +1337,8 @@ def minimize( try: opt.minimize(x0) msg = self._convert_exitflag_to_message(opt) - except RuntimeError: - import sys - import traceback - - msg = "\n".join(traceback.format_exception(*sys.exc_info())) + except RuntimeError as err: + msg = str(err) optimizer_result = OptimizerResult( x=opt.x_min,