From 13f31d3fae0117b9307be4087f9a93caa5f2e16f Mon Sep 17 00:00:00 2001 From: Rock Chin <1010553892@qq.com> Date: Sun, 12 Feb 2023 13:15:33 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E6=8F=92=E4=BB=B6=E5=8A=A0=E8=BD=BD?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5=E6=97=B6=E4=BB=8D=E4=B8=8D=E5=BD=B1=E5=93=8D?= =?UTF-8?q?=E5=90=8E=E5=BA=8F=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/plugin/host.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/pkg/plugin/host.py b/pkg/plugin/host.py index 441fe31..e042509 100644 --- a/pkg/plugin/host.py +++ b/pkg/plugin/host.py @@ -48,11 +48,15 @@ def walk_plugin_path(module, prefix='', path_prefix=''): walk_plugin_path(__import__(module.__name__ + '.' + item.name, fromlist=['']), prefix + item.name + '.', path_prefix + item.name + '/') else: - logging.debug("扫描插件模块: plugins/{}".format(path_prefix + item.name + '.py')) - logging.info('加载模块: plugins/{}'.format(path_prefix + item.name + '.py')) - __current_module_path__ = "plugins/"+path_prefix + item.name + '.py' + try: + logging.debug("扫描插件模块: plugins/{}".format(path_prefix + item.name + '.py')) + __current_module_path__ = "plugins/"+path_prefix + item.name + '.py' - importlib.import_module(module.__name__ + '.' + item.name) + importlib.import_module(module.__name__ + '.' + item.name) + logging.info('加载模块: plugins/{} 成功'.format(path_prefix + item.name + '.py')) + except: + logging.error('加载模块: plugins/{} 失败: {}'.format(path_prefix + item.name + '.py', sys.exc_info())) + traceback.print_exc() def load_plugins():