Skip to content

Commit

Permalink
fix matplotlib display error on python 3.4
Browse files Browse the repository at this point in the history
  • Loading branch information
Leemoonsoo committed Mar 19, 2017
1 parent 3e6603b commit c5e584a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion interpreter/lib/python/backend_zinline.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

from __future__ import print_function

import sys
import uuid
import warnings
import base64
Expand Down Expand Up @@ -94,7 +95,10 @@ def get_bytes(self, **kwargs):
buf = BytesIO()
self.print_figure(buf, **kwargs)
fmt = fmt.encode()
byte_str = b"data:image/%s;base64," %fmt
if sys.version_info >= (3, 4) and sys.version_info < (3, 5):
byte_str = bytes("data:image/%s;base64," %fmt, "utf-8")
else:
byte_str = b"data:image/%s;base64," %fmt
byte_str += base64.b64encode(buf.getvalue())

# Python3 forces all strings to default to unicode, but for raster image
Expand Down

0 comments on commit c5e584a

Please sign in to comment.