Skip to content

Commit 84acc48

Browse files
authored
Update for python3 to import the right StringIO
1 parent dc6b4ab commit 84acc48

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

shape_engine/__init__.py

+7-4
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,12 @@
9595
DateTimeField: ogr.OFTDateTime}
9696

9797
try:
98-
from cStringIO import StringIO
99-
except ImportError:
100-
from StringIO import StringIO
98+
from io import StringIO
99+
except ImportError:
100+
try:
101+
from cStringIO import StringIO
102+
except ImportError:
103+
from StringIO import StringIO
101104

102105
DEFAULT_FIELD_NAME_LENGTH = 10
103106

@@ -111,4 +114,4 @@
111114

112115
ENGINE_MAPPINGS = {ENGINE_FIONA: ENGINE_FIONA_MAPPING,
113116
ENGINE_NATIVE: ENGINE_NATIVE_MAPPING,
114-
ENGINE_CTYPES: ENGINE_CTYPES_MAPPING}
117+
ENGINE_CTYPES: ENGINE_CTYPES_MAPPING}

0 commit comments

Comments
 (0)