[IPython-dev] rubbish null bytes at the end of ipynb file
Gregor Thalhammer
gregor.thalhammer at gmail.com
Tue Jan 21 09:15:05 EST 2014
Am 20.01.2014 um 21:37 schrieb Matthias BUSSONNIER <bussonniermatthias at gmail.com>:
> 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.
Dear Matthias,
thanks for the hint. I opened an issue #4841.
I had a look at the ipython source and can confirm that this should not happen, since saving a notebook essentially only uses the standard json module + encode().
To debug this: How to start a notebook server from a ipython shell (ideally from the source directory) so that I can use pdb for interactive debugging?
Gregor
> --
> 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
>
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20140121/2ac4cf35/attachment.html>
More information about the IPython-dev
mailing list