Improve plugin loader if plugins dir doesn't exist
This commit is contained in:
1 parent
79f0b58cd9
commit
ccdc6811bf
1 file changed
+8
-7
+8
-7
@@ -5,13 +5,14 @@ import imp
|
||||
PLUGINS_PATH = os.path.join(os.path.dirname(__file__), 'plugins')
|
||||
MODULES = []
|
||||
|
||||
for plugin in os.listdir(PLUGINS_PATH):
|
||||
module = os.path.splitext(plugin)[0]
|
||||
try:
|
||||
module = imp.load_module(module, *imp.find_module(module, [PLUGINS_PATH]))
|
||||
MODULES.append(module)
|
||||
except Exception, exception:
|
||||
continue
|
||||
if os.path.isdir(PLUGINS_PATH):
|
||||
for plugin in os.listdir(PLUGINS_PATH):
|
||||
module = os.path.splitext(plugin)[0]
|
||||
try:
|
||||
module = imp.load_module(module, *imp.find_module(module, [PLUGINS_PATH]))
|
||||
MODULES.append(module)
|
||||
except Exception, exception:
|
||||
continue
|
||||
|
||||
def execute(datas, parent):
|
||||
result = {}
|
||||
|
||||
Reference in new issue
Block a user