Replaced imp module with importlib.util since it's depreciated
This commit is contained in:
parent
a82d460da4
commit
f092b8cb20
1 changed files with 9 additions and 3 deletions
12
pyquirks.py
12
pyquirks.py
|
@ -1,9 +1,9 @@
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import imp
|
|
||||||
import re
|
import re
|
||||||
import logging
|
import logging
|
||||||
import logging.config
|
import logging.config
|
||||||
|
import importlib.util
|
||||||
|
|
||||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||||
|
|
||||||
|
@ -16,8 +16,14 @@ PchumLog = logging.getLogger('pchumLogger')
|
||||||
|
|
||||||
class PythonQuirks(ScriptQuirks):
|
class PythonQuirks(ScriptQuirks):
|
||||||
def loadModule(self, name, filename):
|
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):
|
def getExtension(self):
|
||||||
return '.py'
|
return '.py'
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue