Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6a8d05c

Browse files
committed
Merged revisions 8841-8842 via svnmerge from
https://matplotlib.svn.sf.net/svnroot/matplotlib/branches/v1_0_maint ........ r8841 | mdboom | 2010-12-14 12:37:42 -0500 (Tue, 14 Dec 2010) | 2 lines [3137172] Fix cyclical import problem. ........ r8842 | mdboom | 2010-12-17 12:57:59 -0500 (Fri, 17 Dec 2010) | 1 line Fix Unicode encoding error saving SVGs with Unicode characters on some platforms ........ svn path=/trunk/matplotlib/; revision=8843
1 parent 55904d2 commit 6a8d05c

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

lib/matplotlib/backends/backend_svg.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -860,7 +860,7 @@ def print_svg(self, filename, *args, **kwargs):
860860
if is_string_like(filename):
861861
fh_to_close = svgwriter = codecs.open(filename, 'w', 'utf-8')
862862
elif is_writable_file_like(filename):
863-
svgwriter = codecs.EncodedFile(filename, 'utf-8')
863+
svgwriter = codecs.getwriter('utf-8')(filename)
864864
fh_to_close = None
865865
else:
866866
raise ValueError("filename must be a path or a file-like object")
@@ -869,10 +869,10 @@ def print_svg(self, filename, *args, **kwargs):
869869
def print_svgz(self, filename, *args, **kwargs):
870870
if is_string_like(filename):
871871
gzipwriter = gzip.GzipFile(filename, 'w')
872-
fh_to_close = svgwriter = codecs.EncodedFile(gzipwriter, 'utf-8')
872+
fh_to_close = svgwriter = codecs.getwriter('utf-8')(gzipwriter)
873873
elif is_writable_file_like(filename):
874874
fh_to_close = gzipwriter = gzip.GzipFile(fileobj=filename, mode='w')
875-
svgwriter = codecs.EncodedFile(gzipwriter, 'utf-8')
875+
svgwriter = codecs.getwriter('utf-8')(gzipwriter)
876876
else:
877877
raise ValueError("filename must be a path or a file-like object")
878878
return self._print_svg(filename, svgwriter, fh_to_close)

lib/matplotlib/tri/triplot.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import matplotlib.axes
21
from matplotlib.cbook import ls_mapper
32
from matplotlib.patches import PathPatch
43
from matplotlib.path import Path
@@ -39,6 +38,8 @@ def triplot(ax, *args, **kwargs):
3938
4039
.. plot:: mpl_examples/pylab_examples/triplot_demo.py
4140
"""
41+
import matplotlib.axes
42+
4243
tri, args, kwargs = Triangulation.get_from_args_and_kwargs(*args, **kwargs)
4344

4445
x = tri.x

0 commit comments

Comments
 (0)