I had a long script running on iPython notebook in Firefox for a long time. I came back and it seemed to have hung up, so I saved it and closed it.
When I re-open the script, I get a dialog box pop up with the following error:
Warning: unresponsive script
A script on this page may be busy, or it stack overflow may have stopped responding. You can stop the script now, open the script in the debugger, or let the script continue.
The options are 'continue', 'stop script' and 'debug script'. Clicking on any of these leads to the same result, the dialog box disappears and the iPython notebook is unresponsive (for example, ctrl+enter creates a line-break in the current cell rather than executing it).
Worst of all however, the cells at the bottom of the script seem to have been cut off. They contained some valuable code which seems to have gone, this is quite a bad outcome!
I've tried rolling back but the last roll-back point also shows the bottom cut off. Any support here much appreciated!
I have now worked this out and leave it here in the hope it will help others.
The cause of the problem seemed to be an excessively long output from one of the cells - everything below this line had been cut off in the iPython browser, but I discovered it still exists in the .ipynb file and all I had to do was remove some of the output lines, and when I re-opened the file it ran without problems AND my code that had been cut off was available once again.
The notebooks store everything in JSON format. In my case, I needed to remove output from one of the cells, which I did like this:
C:\Users\myname\Documents\IPython Notebooks
notebook.ipynb
file, and edit in a text editor - my choice is Notepad++outputs
property, with "output_type": "stream"
output
property itself, and be sure to remove from the back of a tailing comma to the front of the following comma so that the resulting JSON is well-formedA typical line of output looks like this, deleting several hundred of them made my script run again in the browser:
{
"output_type": "stream",
"stream": "stdout",
"text": [
"\n",
"Added 150000 records so far"
]
},
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With