未验证 提交 c3efdcec 编写于 作者: X xujiaqi01 提交者: GitHub

fix try except in python3 (#62)

上级 6503b232
...@@ -196,7 +196,7 @@ class Trainer(object): ...@@ -196,7 +196,7 @@ class Trainer(object):
self._status_processor[context['status']](context) self._status_processor[context['status']](context)
else: else:
self.other_status_processor(context) self.other_status_processor(context)
except Exception, err: except Exception as err:
traceback.print_exc() traceback.print_exc()
print('Catch Exception:%s' % str(err)) print('Catch Exception:%s' % str(err))
sys.stdout.flush() sys.stdout.flush()
......
...@@ -180,7 +180,7 @@ def lazy_instance_by_package(package, class_name): ...@@ -180,7 +180,7 @@ def lazy_instance_by_package(package, class_name):
globals(), locals(), package.split(".")) globals(), locals(), package.split("."))
instance = getattr(model_package, class_name) instance = getattr(model_package, class_name)
return instance return instance
except Exception, err: except Exception as err:
traceback.print_exc() traceback.print_exc()
print('Catch Exception:%s' % str(err)) print('Catch Exception:%s' % str(err))
return None return None
...@@ -196,7 +196,7 @@ def lazy_instance_by_fliename(abs, class_name): ...@@ -196,7 +196,7 @@ def lazy_instance_by_fliename(abs, class_name):
globals(), locals(), package.split(".")) globals(), locals(), package.split("."))
instance = getattr(model_package, class_name) instance = getattr(model_package, class_name)
return instance return instance
except Exception, err: except Exception as err:
traceback.print_exc() traceback.print_exc()
print('Catch Exception:%s' % str(err)) print('Catch Exception:%s' % str(err))
return None return None
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册