From 181ce577b6b3bc35aefeff3851ec7f4addbab86f Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Wed, 10 Sep 2014 09:26:13 -0400 Subject: [PATCH] BUG : fix str vs bytes issue in py3 in ps backend de-code the encoded ascii string so that it is a string, not bytes, when it gets passed to the format function. Having the b'' from the bytes string appear in the eps file breaks the file. closes #3494 --- lib/matplotlib/backends/backend_ps.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/matplotlib/backends/backend_ps.py b/lib/matplotlib/backends/backend_ps.py index d2e8bc4c7e1e..7be6b3975eff 100644 --- a/lib/matplotlib/backends/backend_ps.py +++ b/lib/matplotlib/backends/backend_ps.py @@ -764,7 +764,7 @@ def draw_text(self, gc, x, y, s, prop, angle, ismath=False, mtext=None): except KeyError: ps_name = sfnt[(3,1,0x0409,6)].decode( 'utf-16be') - ps_name = ps_name.encode('ascii', 'replace') + ps_name = ps_name.encode('ascii', 'replace').decode('ascii') self.set_font(ps_name, prop.get_size_in_points()) cmap = font.get_charmap()