From 461e41cd610d1bff33ac10c6ea5879b498a16f41 Mon Sep 17 00:00:00 2001 From: Benjamin Yolken Date: Fri, 3 Feb 2017 22:36:34 -0800 Subject: [PATCH] Use BytesIO instead of StringIO for python2/3 compatibility --- superset/results_backends.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/superset/results_backends.py b/superset/results_backends.py index 824eb7b227..0448d7c390 100644 --- a/superset/results_backends.py +++ b/superset/results_backends.py @@ -12,13 +12,9 @@ try: except ImportError: import pickle +import io import logging -try: - import StringIO -except ImportError: - import io as StringIO - import boto3 from werkzeug.contrib.cache import BaseCache @@ -56,7 +52,7 @@ class S3Cache(BaseCache): if not self._key_exists(key): return None else: - value_file = StringIO.StringIO() + value_file = io.BytesIO() try: self.s3_client.download_fileobj( @@ -117,7 +113,7 @@ class S3Cache(BaseCache): ``pickle.PickleError``. :rtype: boolean """ - value_file = StringIO.StringIO() + value_file = io.BytesIO() pickle.dump(value, value_file) try: