Skip to content

Commit

Permalink
Python 2.7 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
jonmmease committed Jul 8, 2020
1 parent f65482a commit 22087fb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 5 additions & 1 deletion repos/kaleido/py/kaleido/scopes/base.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
import subprocess
import json
import base64
from json import JSONDecodeError
from threading import Lock, Thread
import io
import os
import sys

try:
from json import JSONDecodeError
except ImportError:
JSONDecodeError = ValueError

executable_path = os.path.join(
os.path.dirname(os.path.dirname(os.path.abspath(__file__))),
'executable',
Expand Down
3 changes: 2 additions & 1 deletion repos/kaleido/py/kaleido/scopes/plotly.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import absolute_import
from kaleido.scopes.base import BaseScope
from _plotly_utils.utils import PlotlyJSONEncoder
import base64
Expand Down Expand Up @@ -108,7 +109,7 @@ def transform(self, figure, format=None, width=None, height=None, scale=None):

# Base64 decode binary types
if format not in self._text_formats:
img = base64.decodebytes(img)
img = base64.b64decode(img)

return img

Expand Down

0 comments on commit 22087fb

Please sign in to comment.