Thursday, 24 June 2021

How to save of the current state of a notebook in JupyterLab

I would like to export a JupyterLab notebook (not Jupyter Notebook) to HTML.

I am using the following code inside of the notebook itself, that correctly exports the notebook:

os.popen('jupyter nbconvert current_notebook.ipynb --to html').read()

However, nbconvert is not getting current notebook but the last saved state, on disk, of the notebook.

So, I need to save the state before trying to export it.

I am trying to use the following code:

%%javascript
IPython.notebook.save_notebook()

But apparently JupyterLab does not support JS API, so it is returning the following message:

Javascript Error: IPython is not defined

Do you know a way to save the current state of the notebook before exporting it?



from How to save of the current state of a notebook in JupyterLab

No comments:

Post a Comment