Add exception handling for module discovery
This commit is contained in:
parent
440d72896f
commit
1fbca4a652
7
main.py
7
main.py
@ -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:")
|
||||||
|
Loading…
Reference in New Issue
Block a user