diff --git a/core/trainer.py b/core/trainer.py index 4d4bd7f765e814250be3d2b05a42cef290cfdf65..9694d0d04f9f6809e72b02045ddce11e3bbe30c8 100755 --- a/core/trainer.py +++ b/core/trainer.py @@ -196,7 +196,7 @@ class Trainer(object): self._status_processor[context['status']](context) else: self.other_status_processor(context) - except Exception, err: + except Exception as err: traceback.print_exc() print('Catch Exception:%s' % str(err)) sys.stdout.flush() diff --git a/core/utils/envs.py b/core/utils/envs.py index c0004cc0dccd8c582c6229bceb8f3636428971a4..bbb2a824e6d3c5268d6ae17caed99410f714f353 100755 --- a/core/utils/envs.py +++ b/core/utils/envs.py @@ -180,7 +180,7 @@ def lazy_instance_by_package(package, class_name): globals(), locals(), package.split(".")) instance = getattr(model_package, class_name) return instance - except Exception, err: + except Exception as err: traceback.print_exc() print('Catch Exception:%s' % str(err)) return None @@ -196,7 +196,7 @@ def lazy_instance_by_fliename(abs, class_name): globals(), locals(), package.split(".")) instance = getattr(model_package, class_name) return instance - except Exception, err: + except Exception as err: traceback.print_exc() print('Catch Exception:%s' % str(err)) return None