Skip modules that cannot import

pull/12/head
Alexandre Dulaunoy 2016-04-26 16:40:03 +02:00
parent b5c113fe4c
commit e3fad8be20
1 changed files with 5 additions and 1 deletions

View File

@ -76,8 +76,12 @@ def load_modules(mod_dir):
modulename = filename.split(".")[0]
moduletype = os.path.split(modulesdir)[1]
modules.append(modulename)
try:
mhandlers[modulename] = importlib.import_module(os.path.basename(root) + '.' + modulename)
except Exception as e:
log.warning('MISP modules {0} failed due to {1}'.format(modulename, e))
continue
log.info('MISP modules {0} imported'.format(modulename))
mhandlers[modulename] = importlib.import_module(os.path.basename(root) + '.' + modulename)
mhandlers['type:' + modulename] = moduletype
return mhandlers, modules