A little change to the ReST previewer to discard errors generated by the docutils converter and sent to sys.stderr.

Sun, 21 Dec 2014 18:00:20 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 21 Dec 2014 18:00:20 +0100
changeset 3981
5cd283505cfa
parent 3979
307b09aae43b
child 3983
9457685bf519

A little change to the ReST previewer to discard errors generated by the docutils converter and sent to sys.stderr.

UI/Previewers/PreviewerHTML.py file | annotate | diff | comparison | revisions
--- a/UI/Previewers/PreviewerHTML.py	Sun Dec 21 15:36:59 2014 +0100
+++ b/UI/Previewers/PreviewerHTML.py	Sun Dec 21 18:00:20 2014 +0100
@@ -471,8 +471,13 @@
                 """ <a href="http://pypi.python.org/pypi/docutils">"""
                 """this page.</a></p>""")
         
-        return docutils.core.publish_string(text, writer_name='html')\
+        # redirect sys.stderr because we are not interested in it here
+        origStderr = sys.stderr
+        sys.stderr = io.StringIO()
+        html = docutils.core.publish_string(text, writer_name='html')\
             .decode("utf-8")
+        sys.stderr = origStderr
+        return html
     
     def __convertMarkdown(self, text):
         """

eric ide

mercurial