summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Totzke <patricktotzke@gmail.com>2018-06-19 21:48:48 +0100
committerGitHub <noreply@github.com>2018-06-19 21:48:48 +0100
commit802e513801ca9200addf8b2278478858d38f337b (patch)
tree338544d208ec60c293beb079cb67e058abadb78a
parentf52c43cbcc06a426d29da122b7682ba69c38c22e (diff)
parent9dcc1b4d75f7db33940e01f2011cb53068da4f9a (diff)
Merge pull request #1247 from pazz/py3k-imports
use importlib to load hooks code at startup
-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: