BookmarkSubscribe
Choose Language Hide Translation Bar
waltp
Community Trekker

Running Jupyter Notebook from JSL

I'd like to run a Jupyter notebook from a JSL script.  I tried the following but without success:

 

//================================================================
// Open Jupyter notebook
//
RunProgram(
Executable( "C:/Users/Owner/Anaconda3/Scripts/jupyter.exe " ),
Options(
{"notebook", "C:/temp/meteorites.ipynb"}
),
Read Function( "text" ),
);
//================================================================

 

If I run this from a command like, the notebook opens as expected:

 

 

C:/Users/Owner/Anaconda3/Scripts/jupyter.exe notebook C:\temp\meteorites.ipynb

 

I'm using JMP 14 on a Windows laptop.  Any suggestions?

 

Thanks,

 

Walt Paczkowski

 

 

 

0 Kudos
5 REPLIES 5
gzmorgan0
Super User

Re: Running Jupyter Notebook from JSL

@waltp ,

I noticed your CMD line prompt uses back slashes (\) for the file name and forward slashe (/) for the JMP option.  You might want to make the JMP option consistent and give it a try.

 

Also, I vaguely recall someone had a security set on their PC that wouldn't allow something like a script calling an executable. Sorry, I don't recall the details.

 

Good luck. Let the blog know if you get it to work.

waltp
Community Trekker

Re: Running Jupyter Notebook from JSL

HI,

 

Thanks for the reply.  I made sure the slashes are the same in the JMP script -- still doesn't work.  The error message in the log is:

 

//
// Open Jupyter notebook

//
RunProgram(
Executable( "C:/Users/Owner/Anaconda3/Scripts/jupyter.exe " ),
Options(
{"notebook", "C:/temp/meteorites.ipynb"}
),
Read Function( "text" ),
);
/*:
"Error executing Jupyter command 'notebook': [Errno 'jupyter-notebook' not found] 2
"

 

 

I know that I can open a notebook from a command prompt; it works.  But it does't work from a script.

 

Walt

0 Kudos
Highlighted
Craige_Hales
Staff (Retired)

Re: Running Jupyter Notebook from JSL

Maybe a PATH issue. Maybe a VirtualEnv issue. I've barely looked at Jupyter, on Linux, so take with grain of salt...

 

One or two of the scripting index examples use CMD.EXE to run commands. That might get the environment set up the way you need it, or allow you to run a PATH or virtualenv command before starting the notebook.

 

 

Craige
Craige_Hales
Staff (Retired)

Re: Running Jupyter Notebook from JSL

re-reading...and searching a bit more...

It looks like the .exe is probably jupyter-notebook.exe and that may not be on the path when JMP launches RunProgram.

Craige
Craige_Hales
Staff (Retired)

Re: Running Jupyter Notebook from JSL

Good point about the slashes. The command line options probably have to be the normal windows \ ; JMP won't be looking at that value and Jupyter might or might not try to fix it up. (Many of JMP's internal filename operations do some normalization of the \ and / characters for MAC and WIN, but only when JMP knows it is a file name.) 

Craige