summaryrefslogtreecommitdiff
path: root/searx/utils.py
diff options
context:
space:
mode:
authorAlexandre Flament <alex@al-f.net>2021-10-06 19:07:26 +0200
committerGitHub <noreply@github.com>2021-10-06 19:07:26 +0200
commitadeb084cf4ffc59f1e49b47d049e7541be6dd5dd (patch)
treea7b7756fe987e46978704f93bae895adcabb1975 /searx/utils.py
parentfeb2d4dda575eb1501fb5a8427de364bed7bc179 (diff)
parentde0249ddae94cc5f320b3da7b434486ff22dc42d (diff)
Merge pull request #390 from return42/fix-312
[fix] don't mix loaded modules with imported modules (sys.modules)
Diffstat (limited to 'searx/utils.py')
-rw-r--r--searx/utils.py4
1 files changed, 0 insertions, 4 deletions
diff --git a/searx/utils.py b/searx/utils.py
index 22824d829..4c2c9e429 100644
--- a/searx/utils.py
+++ b/searx/utils.py
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-import sys
import re
import importlib
@@ -427,13 +426,10 @@ def match_language(locale_code, lang_list=[], custom_aliases={}, fallback='en-US
def load_module(filename, module_dir):
modname = splitext(filename)[0]
- if modname in sys.modules:
- del sys.modules[modname]
filepath = join(module_dir, filename)
# and https://docs.python.org/3/library/importlib.html#importing-a-source-file-directly
spec = importlib.util.spec_from_file_location(modname, filepath)
module = importlib.util.module_from_spec(spec)
- sys.modules[modname] = module
spec.loader.exec_module(module)
return module