changeset 96:9dbdcb1adca1

py3
author Jeff Hammel <k0scist@gmail.com>
date Tue, 03 Nov 2020 10:49:55 -0800
parents 1a8b151888da
children 5fc59dfa7aec
files pyloader/factory.py
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/pyloader/factory.py	Tue Nov 03 10:46:43 2020 -0800
+++ b/pyloader/factory.py	Tue Nov 03 10:49:55 2020 -0800
@@ -23,6 +23,11 @@
     from configparser import InterpolationSyntaxError
     from configparser import SafeConfigParser as ConfigParser
 
+try:
+    string = (str, basestring)
+except NameError:
+    string = (str,)
+
 
 __all__ = ['CircularReferenceError', 'PyFactory', 'IniFactory']
 
@@ -94,7 +99,7 @@
     def interpolate(self, value):
 
         # only interpolate strings
-        if not isinstance(value, basestring):
+        if not isinstance(value, string):
             return value
 
         if value.startswith(self.delimeters[0]) and value.endswith(self.delimeters[1]):
@@ -284,6 +289,7 @@
 
 def main(args=sys.argv[1:]):
     """command line entry point"""
+
     usage = '%prog file1.ini -arg1 -arg2 --key1=value1 --key2=value2'
     parser = OptionParser(usage=usage, description=IniFactory.__doc__)
     options, args = parser.parse_args(args)