From 1fbca4a6526215de64a1395b5bb9844e691e6eaf Mon Sep 17 00:00:00 2001 From: Marcel Schwarz Date: Sun, 15 Dec 2019 07:32:28 +0100 Subject: [PATCH] Add exception handling for module discovery --- main.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index f5ba3d7..c364f5a 100644 --- a/main.py +++ b/main.py @@ -5,8 +5,11 @@ import os print("Loading modules") modules = {} for folder in os.listdir("./modules"): - curr_module = importlib.import_module('.' + folder, package="modules") - modules[folder] = curr_module.get_module() + try: + curr_module = importlib.import_module('.' + folder, package="modules") + modules[folder] = curr_module.get_module() + except AttributeError: + pass print("Modules loaded successfully.\n") print("Available Modules:")