Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 2baedb0

Browse filesBrowse files
committed
Merge pull request #5570 from tomoemon/fix_base64_animation
use base64.encodestring on python2.7
1 parent a385d33 commit 2baedb0
Copy full SHA for 2baedb0

File tree

Expand file treeCollapse file tree

1 file changed

+7
-2
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+7
-2
lines changed

‎lib/matplotlib/animation.py

Copy file name to clipboardExpand all lines: lib/matplotlib/animation.py
+7-2Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,12 @@
2727
import platform
2828
import sys
2929
import itertools
30-
import base64
30+
try:
31+
# python3
32+
from base64 import encodebytes
33+
except ImportError:
34+
# python2
35+
from base64 import encodestring as encodebytes
3136
import contextlib
3237
import tempfile
3338
from matplotlib.cbook import iterable, is_string_like
@@ -927,7 +932,7 @@ def to_html5_video(self):
927932

928933
# Now open and base64 encode
929934
with open(f.name, 'rb') as video:
930-
vid64 = base64.encodebytes(video.read())
935+
vid64 = encodebytes(video.read())
931936
self._base64_video = vid64.decode('ascii')
932937
self._video_size = 'width="{0}" height="{1}"'.format(
933938
*writer.frame_size)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.