Python use case(s) and/or batch processing situation(s)Hi Team!
We have been encountering questions around Python and licensing compliance (batch) issues with some of our high tech customers that I wanted to share within our internal community. I'd love to see this thread turn into a discussion containing not only answers to my questions, but with additional use cases (Python and batch) that you all have encountered.
Note: I am not an expert in Python!
1) Calling JMP using Python (versus calling Python using JMP). Our customers want to do this. I've seen some (non-JMP) material online demonstrating feasibility.
A) Is there an acceptable use case where Python calls JMP? It sounds like a batch situation to me.
If this is a batch situation, does anyone have a canned technical response that we can provide to our customers? I've heard @Jeff_Perkinson say "JMP was not designed or tested for this use case so we cannot warranty any work done using JMP in this manner" (I am poorly paraphrasing here, sorry Jeff!).
2) Does JMP support the Pandas Python library? I saw a post from @IkjuShin on this from 2018 and wonder if any additional material has been produced here or if other SE's have encountered this question.
I found this example in the JMP scripting guide which leads me to believe this is a feasible use case for JMP/Python integrators.
3) A customer would like to create a JSL script containing a While loop for continuous execution. The script would be run on a computer that is essentially dedicated to running JMP. The user would start execution of the script (and, theoretically, end it). I don't have any additional details on the use case but, provided the context of the conversation, imagine that this script would be pinging a database for new data and updating reports.
A) Is this in compliance with our desktop licensing agreement?
Has this been tested and/or what are the technical hurdles towards implementing this in a reliable manner?
Long post...thanks for tuning in and for your contributions!
Re: Python use case(s) and/or batch processing situation(s)Thanks Martin. There is a lot of good content here, some of which is over my head! I will have to reread it a few times.
Re: Python use case(s) and/or batch processing situation(s)Hi Jeff,
A.
I think this PDF will be a very good reference, though from 2009 (https://www.lexjansen.com/nesug/nesug09/ap/AP09.pdf), I've attached it too.
It references some scripting languages and their calls:
COMPARE & CONTRAST
COM Syntax across scripting tools is more alike than different across: Tcl, Perl , Python, R, & VBScript. For example: Start up JMP, Open a Document, Launch a Platform, Run some JSL.
TCL:
package require tcom
set JMP [::tcom::ref createobject "JMP.Application"];
set JMPdoc [$JMP OpenDocument {C:\Big Class.JMP}]
set oneway [$JMPdoc CreateOneway]
$JMP RunCommand "Distribution(
Perl:
use OLE;
use Win32::OLE;
$jmp = Win32::OLE->new('JMP.Application')
my $doc = $jmp->OpenDocument("C:\\Big class.jmp");
$doc -> CreateOneway
$jmp->RunCommand("Distribution(…
Python:
from win32com.client import Dispatch
jmp = Dispatch("JMP.Application")
doc = jmp.OpenDocument("C:/Big class.jmp")
doc.CreateOneway
jmp.RunCommand("Distribution(…
R:
library(rcom)
jmp <- comCreateObject("JMP.Application")
bigclass <- comInvoke(jmp, "OpenDocument", "C:\\Big Class.jmp")
oneway <- comInvoke(bigclass, "CreateOneway")
comInvoke(jmp, "RunCommand",…
VBscript:
set jmp = Wscript.CreateObject("JMP.Application")
set jmpdoc = jmp.OpenDocument("C:/Big class.jmp")
Set Oneway = JMPDoc.CreateOneway
jmp.RunCommand("Distribution(…
B.
This seems to be related, too (from a python page): https://stackoverflow.com/questions/17931476/how-to-call-a-jsl-script-from-python-script
On a mac it mentioned:
import os
os.system('open /Applications/JMP\ Pro\ 13.app/Contents/MacOS/JMP /path/filename.jsl')
there is a space between the path/executable and the path/name.
In your JSL make sure the first line only has //! This will make the script auto-run when its opened. Also, use quit(); as the last line, that way the instance of JMP that is opened gets closed.
Also note: Make sure jmp.exe is available in your system environment so that if you type "jmp.exe" in the command line, it would launch jmp. Then have your *.jsl ready. use python procees to run this command "jmp.exe *.jsl" and that would open jmp and run the *.jsl script and then you can import whatever you generate from jmp back in to python.
And there is another Python thread talking about calling other apps from python: https://stackoverflow.com/questions/247724/how-can-i-launch-an-instance-of-an-application-using-python
Also this community thread might be of interest: https://community.jmp.com/t5/Discussions/jsl-Script-call-from-Python/m-p/206295#M41799
C.
Finally the automation reference (http://www.jmp.com/support/downloads/pdf/jmp1001/automation_reference.pdf) shows how to use OLE automation. Or http://www.jmp.com/support/downloads/pdf/vb_automation_reference.pdf
I haven't tried it out yet, nor have seen someone in my customer base. What I've seen so far is the use case of building a model in JMP convert the final one to a python script and use that in a python based web-interface. The use case was resource planning in an automotive environment for new projects. The model worked much better than the project lead's recommendations. However this might also reduce the amount of users needing to have JMP Pro, if the others can rely on the build model. But this is always possible if you have customers with an analytics group 