Script to run a jupyter notebook automatically

Question:

I have a jupyter notebook with both html and python code in it. Is it possible to write a script that will launch the notebook and run it in the browser? Most solutions on the web refer to running these scripts from the command line, but I want them to show up on the

Asked By: user2330963

||

Answers:

I’m not sure what OS you’re on, but here’s a small batch file that moves into my directory with my .ipynb files, starts Jupyter, and then opens a specific notebook of mine:

cd "%userprofile%desktopatt"
start chrome.exe http://localhost:8888/notebooks/ATT_SQL.ipynb#
jupyter notebook

I just put this on my desktop and double click it to start Jupyter. Just replace your notebook’s name where mine is ATT_SQL.ipynb#. You’ll also have to change the cd command as well.

Edit:
Or better yet:

cd %userprofile%pathtoyourjupyterdir
jupyter notebook yourNotebook.ipynb

Source

Answered By: TheDetective

here is the coding in the batch file i use:
(example.bat)

@echo on

call C:UsersJanaconda3Scriptsactivate C:UsersJanaconda3

cd "C:UsersJZeitgeistProcessing FilesSpyderVisionDaily Run Files"

ipython -c  "%run Module6-Final_Analysis.ipynb"

pause

(example.bat)

"call" = anaconda directory
"cd" = file directory
Answered By: Zeitgeist Spyder
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.