I'd like to reproduce the same functionality as described here: Save an IPython notebook programmatically from within itself?
With the one difference that it should be executed from a JuptyerLab notebook. When I use below code I get an error saying Javascript Error: IPython is not defined
.
import time
from IPython.display import display, Javascript
import hashlib
def save_notebook(file_path):
start_md5 = hashlib.md5(open(file_path,'rb').read()).hexdigest()
display(Javascript('IPython.notebook.save_checkpoint();'))
current_md5 = start_md5
while start_md5 == current_md5:
time.sleep(1)
current_md5 = hashlib.md5(open(file_path,'rb').read()).hexdigest()
Thank you for your consideration.