From 8b89464ca78d2eb04ed97718e1edd5ad04b214cf Mon Sep 17 00:00:00 2001 From: msincenselee Date: Thu, 8 Jun 2017 17:32:54 +0800 Subject: [PATCH] update --- vn.trader/ctaStrategy/strategy/__init__.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/vn.trader/ctaStrategy/strategy/__init__.py b/vn.trader/ctaStrategy/strategy/__init__.py index e3051056..fea65d9a 100644 --- a/vn.trader/ctaStrategy/strategy/__init__.py +++ b/vn.trader/ctaStrategy/strategy/__init__.py @@ -23,14 +23,12 @@ for root, subdirs, files in os.walk(path): if 'strategy' in name and '.pyc' not in name: # 模块名称需要上前缀 moduleName = 'ctaStrategy.strategy.' + name.replace('.py', '') - - print 'loading {0}'.format(moduleName) - try: - # 使用importlib动态载入模块 - module = importlib.import_module(moduleName) - - except: - print 'load fail' + print 'loading {0}'.format(moduleName) + try: + # 使用importlib动态载入模块 + module = importlib.import_module(moduleName) + except Exception as ex: + print 'load fail,excepion:{0}'.format(ex) continue # 遍历模块下的对象,只有名称中包含'Strategy'的才是策略类