diff options
author | Julien Cristau <julien.cristau@logilab.fr> | 2013-06-20 14:27:38 +0200 |
---|---|---|
committer | Julien Cristau <julien.cristau@logilab.fr> | 2013-06-20 14:27:38 +0200 |
commit | 701a93ce71b855d86e26bde0075e27479f1164e2 (patch) | |
tree | c642b26aa72909709986bfebd170ea4ccc7ac7ad | |
parent | c7a5df7f9cb4ad06174655185b319d91ea4f84f2 (diff) | |
download | logilab-common-701a93ce71b855d86e26bde0075e27479f1164e2.tar.gz |
graph: use codecs.open. Closes #155138
Makes python3 happier (can't write utf8 data to a file opened without an
encoding)
-rw-r--r-- | graph.py | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -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 <value> 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': |