From 54d987636e4b03d19a99ad9d143bf63b119af208 Mon Sep 17 00:00:00 2001 From: Adam Tauber Date: Mon, 25 Jul 2016 23:36:52 +0200 Subject: [PATCH] [fix] do not load engines which cannot be initialized - closes #585 --- searx/engines/__init__.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/searx/engines/__init__.py b/searx/engines/__init__.py index 099baa587..52823f1d2 100644 --- a/searx/engines/__init__.py +++ b/searx/engines/__init__.py @@ -57,7 +57,11 @@ def load_module(filename): def load_engine(engine_data): engine_name = engine_data['engine'] - engine = load_module(engine_name + '.py') + try: + engine = load_module(engine_name + '.py') + except: + logger.exception('Cannot load engine "{}"'.format(engine_name)) + return None for param_name in engine_data: if param_name == 'engine': @@ -199,4 +203,5 @@ if 'engines' not in settings or not settings['engines']: for engine_data in settings['engines']: engine = load_engine(engine_data) - engines[engine.name] = engine + if engine is not None: + engines[engine.name] = engine