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
10
pyquirks.py
10
pyquirks.py
|
@ -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'
|
||||
|
|
Loading…
Reference in a new issue