From cbe0062dfe75b50be1eecf7501d5331d07701d37 Mon Sep 17 00:00:00 2001 From: Daniel Lupu Date: Thu, 19 May 2016 00:37:17 +0300 Subject: use importlib to load pugins, and try to load commands from them --- ranger/core/main.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ranger/core/main.py b/ranger/core/main.py index 39d682f7..2972a1eb 100644 --- a/ranger/core/main.py +++ b/ranger/core/main.py @@ -6,6 +6,7 @@ import os.path import sys import tempfile +import importlib def main(): """initialize objects and run the filemanager""" @@ -301,7 +302,8 @@ def load_settings(fm, clean): ranger.fm = fm for plugin in sorted(plugins): try: - module = __import__('plugins', fromlist=[plugin]) + module = importlib.import_module('plugins.' + plugin) + fm.commands.load_commands_from_module(module) fm.log.append("Loaded plugin '%s'." % plugin) except Exception as e: fm.log.append("Error in plugin '%s'" % plugin) -- cgit 1.4.1-2-gfad0