Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 27d5d96

Browse files
committed
FIX now sphinx builds on systems that aren't utf8
The encoding of files (both when reading and writing) was not specified. This caused the documentation build to fail on systems not configured to use utf8 by default. Now, the sphinx-extension gen_gallery specifies the encoding when reading and writing to files and the documention builds properly on all systems.
1 parent ab956b1 commit 27d5d96

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

doc/sphinxext/gen_gallery.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,14 +143,14 @@ def gen_gallery(app, doctree):
143143
gallery_path = os.path.join(app.builder.srcdir,
144144
'_templates', 'gallery.html')
145145
if os.path.exists(gallery_path):
146-
fh = open(gallery_path, 'r')
146+
fh = open(gallery_path, 'r', encoding="utf-8")
147147
regenerate = fh.read() != content
148148
fh.close()
149149
else:
150150
regenerate = True
151151

152152
if regenerate:
153-
fh = open(gallery_path, 'w')
153+
fh = open(gallery_path, 'w', encoding="utf-8")
154154
fh.write(content)
155155
fh.close()
156156

0 commit comments

Comments
 (0)