From 3afe3e76ac2121874cc1200da769ad70f0fbe6ea Mon Sep 17 00:00:00 2001 From: milde Date: Thu, 3 May 2012 11:26:37 +0000 Subject: [PATCH] math2html: Fix writing to sys.stdout/sys.stderr under Py3k. git-svn-id: https://docutils.svn.sourceforge.net/svnroot/docutils/trunk/docutils@7424 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- docutils/math/math2html.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docutils/math/math2html.py b/docutils/math/math2html.py index 6e18b40d1..4a425cea5 100644 --- a/docutils/math/math2html.py +++ b/docutils/math/math2html.py @@ -70,7 +70,8 @@ class Trace(object): def show(cls, message, channel): "Show a message out of a channel" - message = message.encode('utf-8') + if sys.version_info < (3,0): + message = message.encode('utf-8') channel.write(message + '\n') debug = classmethod(debug) @@ -1701,7 +1702,7 @@ class LineWriter(object): "Write a string" if not self.file: self.file = codecs.open(self.filename, 'w', "utf-8") - if self.file == sys.stdout: + if self.file == sys.stdout and sys.version_info < (3,0): string = string.encode('utf-8') self.file.write(string) -- 2.11.4.GIT