From 701a93ce71b855d86e26bde0075e27479f1164e2 Mon Sep 17 00:00:00 2001 From: Julien Cristau Date: Thu, 20 Jun 2013 14:27:38 +0200 Subject: graph: use codecs.open. Closes #155138 Makes python3 happier (can't write utf8 data to a file opened without an encoding) --- graph.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/graph.py b/graph.py index 5cae530..94a71b6 100644 --- a/graph.py +++ b/graph.py @@ -28,7 +28,7 @@ import os.path as osp import os import sys import tempfile -from logilab.common.compat import str_encode +import codecs def escape(value): """Make usable in a dot file.""" @@ -106,8 +106,8 @@ class DotBackend: ppng, outputfile = tempfile.mkstemp(".png", name) os.close(pdot) os.close(ppng) - pdot = open(dot_sourcepath, 'w') - pdot.write(str_encode(self.source, 'utf8')) + pdot = codecs.open(dot_sourcepath, 'w', encoding='utf8') + pdot.write(self.source) pdot.close() if target != 'dot': if sys.platform == 'win32': -- cgit v1.2.1