summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Cristau <julien.cristau@logilab.fr>2013-06-20 14:27:38 +0200
committerJulien Cristau <julien.cristau@logilab.fr>2013-06-20 14:27:38 +0200
commit701a93ce71b855d86e26bde0075e27479f1164e2 (patch)
treec642b26aa72909709986bfebd170ea4ccc7ac7ad
parentc7a5df7f9cb4ad06174655185b319d91ea4f84f2 (diff)
downloadlogilab-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.py6
1 files 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 <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':