changeset 93:93cf6ebe8a94

more -> python3
author Jeff Hammel <k0scist@gmail.com>
date Sun, 10 May 2020 14:47:03 -0700
parents 36f5d31c3ed6
children 65ef62208d05
files pyloader/factory.py pyloader/invoke.py
diffstat 2 files changed, 19 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/pyloader/factory.py	Sun May 10 14:43:00 2020 -0700
+++ b/pyloader/factory.py	Sun May 10 14:47:03 2020 -0700
@@ -4,19 +4,29 @@
 abstract factories
 """
 
+import os
+import sys
 from . import cast
 from . import loader
-import os
-import sys
 from copy import deepcopy
 from optparse import OptionParser
-from ConfigParser import InterpolationDepthError
-from ConfigParser import InterpolationMissingOptionError
-from ConfigParser import InterpolationSyntaxError
-from ConfigParser import SafeConfigParser as ConfigParser
+try:
+    # python 2
+    from ConfigParser import InterpolationDepthError
+    from ConfigParser import InterpolationMissingOptionError
+    from ConfigParser import InterpolationSyntaxError
+    from ConfigParser import SafeConfigParser as ConfigParser
+except ImportError:
+    # python 3
+    from configparser import InterpolationDepthError
+    from configparser import InterpolationMissingOptionError
+    from configparser import InterpolationSyntaxError
+    from configparser import SafeConfigParser as ConfigParser
+
 
 __all__ = ['CircularReferenceError', 'PyFactory', 'IniFactory']
 
+
 class CircularReferenceError(Exception):
     """factory has detected a circular reference"""
 
--- a/pyloader/invoke.py	Sun May 10 14:43:00 2020 -0700
+++ b/pyloader/invoke.py	Sun May 10 14:47:03 2020 -0700
@@ -1,7 +1,8 @@
 import inspect
 import sys
-from cast import cast
-from cast import str2args
+from .cast import cast
+from .cast import str2args
+
 
 def strcall(obj, *args, **kwargs):
     """call a thing with string arguments"""