Replace deprecated imp module with importlib

master
mutantmonkey 2018-10-07 22:24:34 -07:00
parent 9b7d64daac
commit e716729ad7
1 changed files with 2 additions and 2 deletions

4
phenny
View File

@ -12,9 +12,9 @@ Then run ./phenny again
""" """
import argparse import argparse
import imp
import os import os
import sys import sys
from importlib.machinery import SourceFileLoader
from textwrap import dedent as trim from textwrap import dedent as trim
dotdir = os.path.expanduser('~/.phenny') dotdir = os.path.expanduser('~/.phenny')
@ -152,7 +152,7 @@ def main(argv=None):
config_modules = [] config_modules = []
for config_name in config_names(args.config): for config_name in config_names(args.config):
name = os.path.basename(config_name).split('.')[0] + '_config' name = os.path.basename(config_name).split('.')[0] + '_config'
module = imp.load_source(name, config_name) module = SourceFileLoader(name, config_name).load_module()
module.filename = config_name module.filename = config_name
defaults = { defaults = {