Replaced imp module with importlib.util since it's depreciated

This commit is contained in:
Dpeta 2022-03-23 17:46:19 +01:00
parent a82d460da4
commit f092b8cb20

View file

@ -1,9 +1,9 @@
import os
import sys
import imp
import re
import logging
import logging.config
import importlib.util
from PyQt5 import QtCore, QtGui, QtWidgets
@ -16,7 +16,13 @@ PchumLog = logging.getLogger('pchumLogger')
class PythonQuirks(ScriptQuirks):
def loadModule(self, name, filename):
return imp.load_source(name, filename)
# imp is depreciated since Python 3.4
#return imp.load_source(name, filename)
spec = importlib.util.spec_from_file_location(name, filename)
module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(module)
return module
def getExtension(self):
return '.py'