- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Launching python code from a JSL script on a server
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 ?
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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:
- Can you access the path correctly?
- Can you run Python?
- Can you activate venv?
- And so on
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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:
- Can you access the path correctly?
- Can you run Python?
- Can you activate venv?
- And so on
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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.