From 1968aa019745f1850532525223c01f5921213432 Mon Sep 17 00:00:00 2001 From: Johann Dreo Date: Thu, 23 May 2013 14:15:41 +0200 Subject: [PATCH] Use python3's importlib instead of __import__ --- colout/colout.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/colout/colout.py b/colout/colout.py index 0f7cfc3..4f242ce 100755 --- a/colout/colout.py +++ b/colout/colout.py @@ -10,6 +10,7 @@ import random import os import glob import math +import importlib ########### # Library # @@ -73,9 +74,10 @@ themes = {} themes_dir=os.path.dirname(os.path.realpath(__file__)) os.chdir( themes_dir ) for f in glob.iglob("colout_*.py"): - module = ".".join(f.split(".")[:-1]) - name = "_".join(module.split("_")[1:]) - themes[name] = __import__(module) + module = ".".join(f.split(".")[:-1]) # remove extension + name = "_".join(module.split("_")[1:]) # remove the prefix + print(themes_dir,module,name) + themes[name] = importlib.import_module(module) # load available pygments lexers lexers = []