Skip to content

Commit 0543a21

Browse files
author
y-p
committed
BLD: ipython_directive, decode ipython output as utf8+replace
1 parent 3dbb9ea commit 0543a21

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

doc/sphinxext/ipython_directive.py

+8
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,14 @@ def process_input_line(self, line, store_history=True):
320320
self.IP.run_cell(source_raw, store_history=store_history)
321321
finally:
322322
sys.stdout = stdout
323+
buflist = self.cout.buflist
324+
for i in range(len(buflist)):
325+
try:
326+
# print(buflist[i])
327+
if not isinstance(buflist[i], unicode):
328+
buflist[i] = buflist[i].decode('utf8','replace')
329+
except:
330+
pass
323331

324332
def process_image(self, decorator):
325333
"""

0 commit comments

Comments
 (0)