From c8447a77ee1e1d88ae5d7983414cdb1fb088d381 Mon Sep 17 00:00:00 2001 From: Stijn Peeters Date: Tue, 15 Feb 2022 14:44:29 +0100 Subject: [PATCH] Ignore modules with syntax errors in them --- common/lib/module_loader.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/common/lib/module_loader.py b/common/lib/module_loader.py index 6d7016477..cdc9dbd52 100644 --- a/common/lib/module_loader.py +++ b/common/lib/module_loader.py @@ -93,13 +93,14 @@ def load_modules(self): # try importing try: module = importlib.import_module(module_name) - except ImportError as e: + except (SyntaxError, ImportError) as e: # this is fine, just ignore this data source and give a heads up self.ignore.append(module_name) - if e.name not in self.missing_modules: - self.missing_modules[e.name] = [module_name] + key_name = e.name if hasattr(e, "name") else module_name + if key_name not in self.missing_modules: + self.missing_modules[key_name] = [module_name] else: - self.missing_modules[e.name].append(module_name) + self.missing_modules[key_name].append(module_name) continue # see if module contains the right type of content by looping