index 0a5d57e6cfe6030eec55df16fecb28b45a828c66..9c1e9fb1ba7aad1877ba90bb3cb5bf86315d1d06 100644 (file)
#
# Copyright © 2009 Adrian Perez <aperez@igalia.com>
#
-# Distributed under terms of the GPLv2 license.
+# Distributed under terms of the GPLv2 license or newer.
#
# Frank Marien (frank@apsu.be) 6 Sep 2012
# - quick fixes for 5.1 binary protocol
"""
import socket,struct,sys
-try:
- from io import StringIO
-except ImportError:
- from cStringIO import StringIO
+import platform
+if platform.python_version() < '2.8.0':
+ # Python 2.7 and below io.StringIO does not like unicode
+ from StringIO import StringIO
+else:
+ try:
+ from io import StringIO
+ except ImportError:
+ from cStringIO import StringIO
from datetime import datetime
from copy import deepcopy