8000 use base64.encodestring on python2.7 by tomoemon · Pull Request #5570 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

use base64.encodestring on python2.7 #5570

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 30, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
use base64.encodestring on python2.7
  • Loading branch information
tomoemon committed Nov 27, 2015
commit c7e98aa744a7079b57d0bdc085c2526b764afcb0
9 changes: 7 additions & 2 deletions lib/matplotlib/animation.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,12 @@
import platform
import sys
import itertools
import base64
try:
# python3
from base64 import encodebytes
except ImportError:
# python2
from base64 import encodestring as encodebytes
import contextlib
import tempfile
from matplotlib.cbook import iterable, is_string_like
Expand Down Expand Up @@ -928,7 +933,7 @@ def to_html5_video(self):

# Now open and base64 encode
with open(f.name, 'rb') as video:
vid64 = base64.encodebytes(video.read())
vid64 = encodebytes(video.read())
self._base64_video = vid64.decode('ascii')
self._video_size = 'width="{0}" height="{1}"'.format(
*writer.frame_size)
Expand Down
0