Use python3's importlib instead of __import__
This commit is contained in:
parent
1fed20cba7
commit
1968aa0197
1 changed files with 5 additions and 3 deletions
|
|
@ -10,6 +10,7 @@ import random
|
||||||
import os
|
import os
|
||||||
import glob
|
import glob
|
||||||
import math
|
import math
|
||||||
|
import importlib
|
||||||
|
|
||||||
###########
|
###########
|
||||||
# Library #
|
# Library #
|
||||||
|
|
@ -73,9 +74,10 @@ themes = {}
|
||||||
themes_dir=os.path.dirname(os.path.realpath(__file__))
|
themes_dir=os.path.dirname(os.path.realpath(__file__))
|
||||||
os.chdir( themes_dir )
|
os.chdir( themes_dir )
|
||||||
for f in glob.iglob("colout_*.py"):
|
for f in glob.iglob("colout_*.py"):
|
||||||
module = ".".join(f.split(".")[:-1])
|
module = ".".join(f.split(".")[:-1]) # remove extension
|
||||||
name = "_".join(module.split("_")[1:])
|
name = "_".join(module.split("_")[1:]) # remove the prefix
|
||||||
themes[name] = __import__(module)
|
print(themes_dir,module,name)
|
||||||
|
themes[name] = importlib.import_module(module)
|
||||||
|
|
||||||
# load available pygments lexers
|
# load available pygments lexers
|
||||||
lexers = []
|
lexers = []
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue