cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
The Discovery Summit 2025 Call for Content is open! Submit an abstract today to present at our premier analytics conference.
Get the free JMP Student Edition for qualified students and instructors at degree granting institutions.
Choose Language Hide Translation Bar
View Original Published Thread

Launching python code from a JSL script on a server

SophieCuvillier
Level IV

Hello all, 

 

In a server (without internet connection), I have a JSL script that calls at some point a python script (in a virtual environment). Below is the JSL command that calls the python. The python is stored in a F:\ Disk.


strCommand = “Path\to\virutual_env\.venv\Scripts\activate.bat\!&& python \!“Path\to\python_script.py\!””;
Run Program( Executable( “cmd.exe” ), Options(/C ” || strCommand ) );
  • If I run the same command directly in the server command prompt (in administrator mode or not):“Path\to\virutual_env\.venv\Scripts\activate.bat” && python “Path\to\python_script.py\”,  it works
  • If I run this JSL code on my PC, it also works.

However, if I run this JSL code on the server, it doesn't work anymore. No python is run, but no error message. 

 

For information: as I don't have Internet access, for the python virtual environment I manually transferred the packages to the server and activated the environment to read the packages.

 

Anyone had the same issue ?

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User


Re: Launching python code from a JSL script on a server

Do you have the same paths on your PC and on the server? Does either of them have any spaces in the paths (there could potentially be some issues with the quotes when using Run Program)? Start breaking the problem into smaller parts:

  1. Can you access the path correctly?
  2. Can you run Python?
  3. Can you activate venv?
  4. And so on
-Jarmo

View solution in original post

6 REPLIES 6
jthi
Super User


Re: Launching python code from a JSL script on a server

Do you have the same paths on your PC and on the server? Does either of them have any spaces in the paths (there could potentially be some issues with the quotes when using Run Program)? Start breaking the problem into smaller parts:

  1. Can you access the path correctly?
  2. Can you run Python?
  3. Can you activate venv?
  4. And so on
-Jarmo


Re: Launching python code from a JSL script on a server

Hello,

 

Thank you very much! In fact, the problem was that there was a space in the path

jthi
Super User


Re: Launching python code from a JSL script on a server

How did you solve that issue? Did you "fix" the file path or try to figure out how it should be quoted for JMP / commandline to understand what you are trying to do?

-Jarmo


Re: Launching python code from a JSL script on a server

As I had to do a quick fix, I first removed the spaces in the path. I must admit that I didn't come back to the subject afterwards... but I'm in discussion with JMP support. They suggest using Python from JMP18, but they don't support virtual environments, so you'd have to install the package versions directly from them. And I have customers who are ‘only’ using JMP 17 at the moment and would like the same thing.I'll keep you posted

 

jthi
Super User


Re: Launching python code from a JSL script on a server

Pass quote into Run Program application has one option. I have used something similar when I had to pass quotes to Run Program and if I remember correctly also some other methods.

-Jarmo
Craige_Hales
Super User


Re: Launching python code from a JSL script on a server

https://community.jmp.com/t5/Discussions/Unable-to-parse-speechmarks-quot-quot-into-powershell-using... ( in  Unable to parse speechmarks "" into powershell using RunProgram ) has links to an explanation of why the windows command line quoting is so hard. Removing the spaces in a path name is a great choice.

Craige