Skip to content

Commit

Permalink
Use BytesIO instead of StringIO for python2/3 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
Benjamin Yolken committed Feb 4, 2017
1 parent 7164061 commit 461e41c
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions superset/results_backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,9 @@
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

Expand Down Expand Up @@ -56,7 +52,7 @@ def get(self, key):
if not self._key_exists(key):
return None
else:
value_file = StringIO.StringIO()
value_file = io.BytesIO()

try:
self.s3_client.download_fileobj(
Expand Down Expand Up @@ -117,7 +113,7 @@ def set(self, key, value, timeout=None):
``pickle.PickleError``.
:rtype: boolean
"""
value_file = StringIO.StringIO()
value_file = io.BytesIO()
pickle.dump(value, value_file)

try:
Expand Down

0 comments on commit 461e41c

Please sign in to comment.