Re: Traceback output

Guenter Milde <[email protected]>
Newsgroups gmane.text.docutils.user
Message-ID <[email protected]>
Dear Konstas,

sorry for the problems, thank you for reporting them.
On 2014-05-23, Konstas Marmatakis wrote:

>     I tried to use sphinx rst2html to convert  rst file to html.

>     The command was:
>             C:\python33\Scripts\rst2html.py INSTALL.rst
>             OS: Windows 7 64bit (Greek)
>             Python: version 3.3.3

Then you actually did not use Sphinx but (pur) Docutils. This means you are
at the right list.

It looks like you found one of the never-ending encoding problems aggravated
by the Python 2-3 divide.

In Python 2, most methods would "do the right thing" regarding unicode<->bytes
conversiond. However, in 3.3.:

 The methods on bytes and bytearray objects don’t accept strings as
 their arguments, just as the methods on strings don’t accept bytes as
 their arguments. 
 
 -- https://docs.python.org/3.3/library/stdtypes.html#bytes-methods


Does the following patch help?

Günter

Index: io.py
===================================================================
--- io.py	(Revision 7743)
+++ io.py	(Arbeitskopie)
@@ -369,9 +369,9 @@
         if ('b' not in self.mode and sys.version_info < (3,0)
             or check_encoding(self.destination, self.encoding) is False
            ):
+            data = self.encode(data)
             if sys.version_info >= (3,0) and os.linesep != '\n':
-                data = data.replace('\n', os.linesep) # fix endings
-            data = self.encode(data)
+                data = data.replace(b('\n'), b(os.linesep)) # fix endings
 
         try: # In Python < 2.5, try...except has to be nested in try...finally.
             try:


------------------------------------------------------------------------------
The best possible search technologies are now affordable for all companies.
Download your FREE open source Enterprise Search Engine today!
Our experts will assist you in its installation for $59/mo, no commitment.
Test it for FREE on our Cloud platform anytime!
http://pubads.g.doubleclick.net/gampad/clk?id=145328191&iu=/4140/ostg.clktrk
_______________________________________________
Docutils-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/docutils-users

Please use "Reply All" to reply to the list.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.