From 70e7f0669e63449f2a0fa3bb1c858fb4e67ee693 2013-07-19 22:24:45 From: MinRK Date: 2013-07-19 22:24:45 Subject: [PATCH] fix unicode file-writing in svg2pdf --- diff --git a/IPython/nbconvert/transformers/svg2pdf.py b/IPython/nbconvert/transformers/svg2pdf.py index b630b8e..b6d7347 100644 --- a/IPython/nbconvert/transformers/svg2pdf.py +++ b/IPython/nbconvert/transformers/svg2pdf.py @@ -14,6 +14,7 @@ one format to another. #----------------------------------------------------------------------------- import base64 +import io import os import sys import subprocess @@ -73,7 +74,8 @@ class SVG2PDFTransformer(ConvertFiguresTransformer): #Write fig to temp file input_filename = os.path.join(tmpdir, 'figure.' + data_format) - with open(input_filename, 'wb') as f: + # SVG data is unicode text + with io.open(input_filename, 'w', encoding='utf8') as f: f.write(data) #Call conversion application