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 c7e98aa

Browse filesBrowse files
committed
use base64.encodestring on python2.7
1 parent 6245d4e commit c7e98aa
Copy full SHA for c7e98aa

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
@@ -928,7 +933,7 @@ def to_html5_video(self):
928933

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

0 commit comments

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