[IPython-dev] rubbish null bytes at the end of ipynb file

Matthias BUSSONNIER bussonniermatthias at gmail.com
Mon Jan 20 15:37:04 EST 2014


Hi, 

Le 20 janv. 2014 à 17:59, Gregor Thalhammer a écrit :

> Dear developers,
> 
> sometimes it happens to me that at the very end of my notebook files null bytes (0x00) are appended (I observed between 2 and several hundreds) . The notebook files fail to load ('bad request') the next time. Also nbconvert fails:
> ...
>   File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/IPython/nbformat/reader.py", line 44, in parse_json
>     raise NotJSONError(("Notebook does not appear to be JSON: %r" % s)[:77] + "...")
> NotJSONError: Notebook does not appear to be JSON: u'{\n "metadata": {\n  "name": ""\n },\n...
> 

This is **really** weird. 

Could you open an issue on github ? 

Notebook are written in 
	IPython/html/services/notebooks/filenbmanager.py ~L243. 

You can try to have a check with a retry to get warn 'on write' when this happen to narrow the issue. 
Problem is that we do use std lib to write JSON, so this should never happened.
-- 
M

> Luckily such an file can be resurrected by deleting the null bytes.
> This only happens sometimes, but with a file containing a lot of inline pylab figures (png) and heavy recreating of figures this happens quite often.
> 
> What could I do to localize the root of this problem?
> 
> I am using recent ipython from git, with python 2.7 on osx 10.9.
> 
> thanks for your help
> Gregor
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev




More information about the IPython-dev mailing list