Add exception handling for module discovery

This commit is contained in:
Marcel Schwarz 2019-12-15 07:32:28 +01:00
parent 440d72896f
commit 1fbca4a652

View File

@ -5,8 +5,11 @@ import os
print("Loading modules") print("Loading modules")
modules = {} modules = {}
for folder in os.listdir("./modules"): for folder in os.listdir("./modules"):
curr_module = importlib.import_module('.' + folder, package="modules") try:
modules[folder] = curr_module.get_module() curr_module = importlib.import_module('.' + folder, package="modules")
modules[folder] = curr_module.get_module()
except AttributeError:
pass
print("Modules loaded successfully.\n") print("Modules loaded successfully.\n")
print("Available Modules:") print("Available Modules:")