Add exception handling for module discovery
This commit is contained in:
parent
440d72896f
commit
1fbca4a652
3
main.py
3
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"):
|
||||||
|
try:
|
||||||
curr_module = importlib.import_module('.' + folder, package="modules")
|
curr_module = importlib.import_module('.' + folder, package="modules")
|
||||||
modules[folder] = curr_module.get_module()
|
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