Merge pull request #36 from mirzaees/fix_DeprecationWarning

fixed DeprecationWarning in stripmapWrapper and SentinelWrapper
LT1AB
piyushrpt 2019-05-07 19:53:47 -07:00 committed by GitHub
commit 70426ef532
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 19 deletions

View File

@ -98,10 +98,10 @@ def main(factoryFile,package,buildDir):
# import isce # import isce
import filecmp import filecmp
try: try:
import imp import importlib
factoryFile = os.path.abspath(factoryFile) factoryFile = os.path.abspath(factoryFile)
mod = imp.find_module(factoryFile.replace('.py','')) mod = importlib.util.spec_from_file_location('.', factoryFile)
factModule = imp.load_module(factoryFile.replace('.py',''),mod[0],mod[1],mod[2]) factModule = mod.loader.load_module()
factoriesInfo = factModule.getFactoriesInfo() factoriesInfo = factModule.getFactoriesInfo()
nameList = [] nameList = []
for k,v in factoriesInfo.items(): for k,v in factoriesInfo.items():

View File

@ -1,5 +1,6 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import os, imp, sys import os, sys
import importlib
import argparse import argparse
import configparser import configparser
@ -21,7 +22,7 @@ class ConfigParser:
# Setting up and reading config # Setting up and reading config
Config = configparser.ConfigParser() Config = configparser.ConfigParser()
Config.optionxform = str Config.optionxform = str
Config.readfp(content) Config.read_file(content)
# Reading the function sequence followed by input parameters # Reading the function sequence followed by input parameters
# followed by the function parameters # followed by the function parameters
@ -94,14 +95,12 @@ class ConfigParser:
# If any of the following calls raises an exception, # If any of the following calls raises an exception,
# there's a problem we can't handle -- let the caller handle it. # there's a problem we can't handle -- let the caller handle it.
fp, pathname, description = imp.find_module(name) spec = importlib.util.find_spec(name)
try: try:
return imp.load_module(name, fp, pathname, description) return spec.loader.load_module()
finally: except ImportError:
# Since we may exit via an exception, close fp explicitly. print('module {} not found'.format(name))
if fp:
fp.close()
# Check existence of the input file # Check existence of the input file
def check_if_files_exist(Files, ftype='input'): def check_if_files_exist(Files, ftype='input'):

View File

@ -1,5 +1,6 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import os, imp, sys import os, sys
import importlib
import argparse import argparse
import configparser import configparser
@ -22,7 +23,7 @@ class ConfigParser:
# Setting up and reading config # Setting up and reading config
Config = configparser.ConfigParser() Config = configparser.ConfigParser()
Config.optionxform = str Config.optionxform = str
Config.readfp(content) Config.read_file(content)
# Reading the function sequence followed by input parameters # Reading the function sequence followed by input parameters
# followed by the function parameters # followed by the function parameters
@ -157,14 +158,12 @@ class ConfigParser:
# If any of the following calls raises an exception, # If any of the following calls raises an exception,
# there's a problem we can't handle -- let the caller handle it. # there's a problem we can't handle -- let the caller handle it.
fp, pathname, description = imp.find_module(name) spec = importlib.util.find_spec(name)
try: try:
return imp.load_module(name, fp, pathname, description) return spec.loader.load_module()
finally: except ImportError:
# Since we may exit via an exception, close fp explicitly. print('module {} not found'.format(name))
if fp:
fp.close()
# Check existence of the input file # Check existence of the input file
def check_if_files_exist(Files, ftype='input'): def check_if_files_exist(Files, ftype='input'):