mirror of
https://github.com/ceres-solver/ceres-solver.git
synced 2026-08-30 00:50:37 +08:00
make_docs: Pass the file encoding to open()
Otherwise, it will fail on Python 3 with: "UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 7690: ordinal not in range(128)" We have to use io.open() instead of open(), because open() does not accept the encoding on Python 2. Change-Id: I77b6552491e8de01d79a26d2f146ddbd968cce49
This commit is contained in:
@@ -35,6 +35,7 @@
|
||||
|
||||
from __future__ import print_function
|
||||
import glob
|
||||
import io
|
||||
import os
|
||||
import sys
|
||||
|
||||
@@ -102,7 +103,7 @@ breadcrumb_end = \
|
||||
|
||||
for name in glob.glob('%s/*.html' % html_dir):
|
||||
print('Postprocessing: ', name)
|
||||
with open(name) as fptr:
|
||||
with io.open(name, encoding="utf-8") as fptr:
|
||||
out = fptr.read()
|
||||
|
||||
for input_pattern, output_pattern in replacements:
|
||||
@@ -119,5 +120,5 @@ for name in glob.glob('%s/*.html' % html_dir):
|
||||
except ValueError:
|
||||
print('Skipping breadcrumb strip for', name)
|
||||
|
||||
with open(name, 'w') as fptr:
|
||||
with io.open(name, 'w', encoding="utf-8") as fptr:
|
||||
fptr.write(out)
|
||||
|
||||
Reference in New Issue
Block a user