You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since https://bitbucket.org/birkenfeld/sphinx/commits/471ff5bc89c6 documentation of restkit fails to build. Some paths became unicode strings. Operation with mixed str and unicode triggers implicit decoding of str to unicode with ASCII encoding (instead of UTF-8), which results in UnicodeDecodeError.
$ make html
...
Exception occurred:
File "/tmp/restkit/doc/./sphinxtogithub.py", line 40, in process
return text.replace( self.from_, self.to )
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 2822: ordinal not in range(128)
The full traceback has been saved in /tmp/sphinx-err-AEbScF.log, if you want to report the issue to the developers.
make: *** [html] Error 1
$ cat /tmp/sphinx-err-AEbScF.log
# Sphinx version: 1.2pre
# Python version: 2.7.3+
# Docutils version: 0.10 release
# Jinja2 version: 2.6
Traceback (most recent call last):
File "/usr/lib64/python2.7/site-packages/sphinx/cmdline.py", line 238, in main
app.build(force_all, filenames)
File "/usr/lib64/python2.7/site-packages/sphinx/application.py", line 217, in build
self.emit('build-finished', None)
File "/usr/lib64/python2.7/site-packages/sphinx/application.py", line 350, in emit
results.append(callback(self, *args))
File "/tmp/restkit/doc/./sphinxtogithub.py", line 311, in sphinx_extension
layout.process()
File "/tmp/restkit/doc/./sphinxtogithub.py", line 175, in process
handler.process()
File "/tmp/restkit/doc/./sphinxtogithub.py", line 56, in process
text = replacer.process( text )
File "/tmp/restkit/doc/./sphinxtogithub.py", line 40, in process
return text.replace( self.from_, self.to )
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 2822: ordinal not in range(128)
Patch:
--- doc/sphinxtogithub.py
+++ doc/sphinxtogithub.py
@@ -2,10 +2,22 @@
import optparse as op
import os
+import re
+import sphinx
import sys
import shutil
+def get_number(text):
+ m = re.match("[0-9]+", text)
+ if m:
+ return int(m.group(0))
+ else:
+ return 0
+
+def get_sphinx_version():
+ return tuple(get_number(x) for x in sphinx.__version__.split("."))
+
class NoDirectoriesError(Exception):
"Error thrown when no directories starting with an underscore are found"
@@ -51,10 +63,14 @@ class FileHandler(object):
def process(self):
text = self.opener(self.name).read()
+ if get_sphinx_version() >= (1, 2):
+ text = text.decode("utf-8")
for replacer in self.replacers:
text = replacer.process( text )
+ if get_sphinx_version() >= (1, 2):
+ text = text.encode("utf-8")
self.opener(self.name, "w").write(text)
class Remover(object):
The text was updated successfully, but these errors were encountered:
Since https://bitbucket.org/birkenfeld/sphinx/commits/471ff5bc89c6 documentation of restkit fails to build. Some paths became unicode strings. Operation with mixed str and unicode triggers implicit decoding of str to unicode with ASCII encoding (instead of UTF-8), which results in UnicodeDecodeError.
Patch:
The text was updated successfully, but these errors were encountered: