From 2f3a590935e41925e1aabc86965caaa2c6a90026 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Bia=C5=82ek?= Date: Sun, 2 Jun 2024 20:36:30 +0200 Subject: [PATCH] Ignore plugins not having DeyePlugin class MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Krzysztof BiaƂek --- src/deye_plugin_loader.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/deye_plugin_loader.py b/src/deye_plugin_loader.py index 9824a96..84d34f7 100644 --- a/src/deye_plugin_loader.py +++ b/src/deye_plugin_loader.py @@ -52,7 +52,10 @@ def load_plugins(self, plugin_context: DeyePluginContext): for plugin_name in discovered_plugins: self.__log.info("Loading plugin: '%s'", plugin_name) plugin_module = discovered_plugins[plugin_name] - self.__plugins.append(plugin_module.DeyePlugin(plugin_context)) + try: + self.__plugins.append(plugin_module.DeyePlugin(plugin_context)) + except AttributeError: + self.__log.warn("Ignoring plugin '%s', because DeyePlugin class is not defined.", plugin_name) def get_event_processors(self) -> [DeyeEventProcessor]: event_processors = []