summaryrefslogtreecommitdiff
path: root/alot/settings
diff options
context:
space:
mode:
authorPatrick Totzke <patricktotzke@gmail.com>2018-06-18 20:09:07 +0100
committerPatrick Totzke <patricktotzke@gmail.com>2018-06-19 21:47:26 +0100
commit9dcc1b4d75f7db33940e01f2011cb53068da4f9a (patch)
tree338544d208ec60c293beb079cb67e058abadb78a /alot/settings
parentf52c43cbcc06a426d29da122b7682ba69c38c22e (diff)
use importlib to load hooks code at startup
imp is deprecated in favor of importlib.
Diffstat (limited to 'alot/settings')
-rw-r--r--alot/settings/manager.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/alot/settings/manager.py b/alot/settings/manager.py
index 56e6eec8..81716cac 100644
--- a/alot/settings/manager.py
+++ b/alot/settings/manager.py
@@ -3,7 +3,7 @@
# For further details see the COPYING file
from __future__ import absolute_import
-import imp
+import importlib.util
import itertools
import logging
import mailcap
@@ -90,7 +90,9 @@ class SettingsManager(object):
hooks_path = os.path.expanduser(self._config.get('hooksfile'))
try:
- self.hooks = imp.load_source('hooks', hooks_path)
+ spec = importlib.util.spec_from_file_location('hooks', hooks_path)
+ self.hooks = importlib.util.module_from_spec(spec)
+ spec.loader.exec_module(self.hooks)
except:
logging.exception('unable to load hooks file:%s', hooks_path)
if 'bindings' in newconfig: