How can I run jupyter notebook (which itself launches other notebooks) in python script (.py
)?
Asked
Active
Viewed 848 times
0

Itsme
- 1
-
I don't know if there's a slicker way, but you can use the `subprocess` package to launch a notebook just like you would at your system's console. – CryptoFool Apr 11 '22 at 23:05
-
1Could you please give an example how can I use it? – Itsme Apr 11 '22 at 23:08
-
What about this: https://stackoverflow.com/questions/26338688/start-ipython-notebook-with-python-file ? – Bguess Apr 11 '22 at 23:12
-
I like `os.system()` with the command to execute the notebook on the command line placed in the parentheses, see [here](https://www.journaldev.com/16140/python-system-command-os-subprocess-call). (I cannot confirm how windows does with this.) Once you grok how to trigger a command line command in a python script, then your question becomes how do I run a Jupyter notebook from the command line. For that you can see [this post](https://discourse.jupyter.org/t/run-ipynb-on-a-remote-workstation-so-that-all-results-will-be-save-in-the-same-pynb/13340/2?u=fomightez). – Wayne Apr 12 '22 at 01:11
-
Plus, to continue that last line... also see [this one about nbtoolbelt option](https://discourse.jupyter.org/t/how-to-run-a-notebook-using-command-line/3475/14?u=fomightez). – Wayne Apr 12 '22 at 01:12