From 8b08f0cd2d3f1ef0b51500745c2451318e3ca11b 2014-10-08 19:33:34 From: MinRK Date: 2014-10-08 19:33:34 Subject: [PATCH] cast writes to unicode before write --- diff --git a/IPython/nbformat/current.py b/IPython/nbformat/current.py index b6e8d3d..0f796fd 100644 --- a/IPython/nbformat/current.py +++ b/IPython/nbformat/current.py @@ -174,13 +174,9 @@ def write(nb, fp, format='DEPRECATED', **kwargs): The notebook to write. fp : file Any file-like object with a write method. - format : (u'json', u'ipynb', u'py') - The format to write the notebook in. - - Returns - ------- - s : unicode - The notebook string. """ - return fp.write(writes(nb, **kwargs)) + s = writes(nb, **kwargs) + if isinstance(s, bytes): + s = s.decode('utf8') + return fp.write(s)