From 68ca2a437899e4a3f80064f68e43998054341e1b Mon Sep 17 00:00:00 2001 From: Florian Mounier Date: Tue, 3 Apr 2012 15:28:38 +0200 Subject: [PATCH] cairosvg python 3 --- pygal/graph/base.py | 4 ++-- pygal/test/test_graph.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pygal/graph/base.py b/pygal/graph/base.py index 1bccf3e..639e20f 100644 --- a/pygal/graph/base.py +++ b/pygal/graph/base.py @@ -205,8 +205,8 @@ class BaseGraph(object): def render_to_png(self, filename): import cairosvg - import StringIO - fakefile = StringIO.StringIO() + from io import BytesIO + fakefile = BytesIO() fakefile.write(self.render()) fakefile.seek(0) cairosvg.surface.PNGSurface.convert( diff --git a/pygal/test/test_graph.py b/pygal/test/test_graph.py index 2dcda95..dc43e02 100644 --- a/pygal/test/test_graph.py +++ b/pygal/test/test_graph.py @@ -61,6 +61,6 @@ def test_render_to_png(): line = Line() line.add('Serie 1', [1]) line.render_to_png(file_name) - with open(file_name) as f: + with open(file_name, 'rb') as f: assert f.read() os.remove(file_name)