- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Create an add-in to run a python script
Hello,
Thanks @martindemel for the advice, so I will repost my questions.
I would like to create an add-in to run a python script, can you please help ?
Thanks in advance
Ahmed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Create an add-in to run a python script
What issues are you having? If you have JMP18 it won't really differ that much from running JSL (outside of the possible python package management).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Create an add-in to run a python script
Hello,
I'm using JMP18 and I'm probably doing this wrong. I'm creating a new add-on and, from the "Menu Items" tab. Then I select "add command", in action window there is only "Run JSL in this file" or "Run this JSL".
I have selected my python script but as expected it fails.
So how to have in action list Run PY in this file? is there another way?
Thanks,
Ahmed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Create an add-in to run a python script
We are still working at improving the Python integration across JMP. JMP's integration knows the directory that the JSL script is running from. At present the code needs to be keyed off of a JSL script which can call the Python. You can create JSL User Defined functions that are implemented in Python https://community.jmp.com/t5/JMPer-Cable/Creating-JSL-functions-implemented-in-Python/, Python Submit File("your_code.py"); and if the .py file is in the same directory as the JSL script, something like
Python Submit("\[
import your_code
results = your_code.function( )
]\");
Python Get( "results");
Should also work
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Create an add-in to run a python script
I agree with Jarmo, it might be that you first need to assure the package you are using is known to JMP. Would be good to understand where you have issues. Under view->log you may get warnings or error messages which can help to identify the issue.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Create an add-in to run a python script
By using Run JSL, I logically have syntax issues because it is a python scrip.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Create an add-in to run a python script
Create JSL file which is able to run your Python code and test that it is working. Then use that JSL file in the add-in while making sure all files are in correct locations for it to run properly.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Create an add-in to run a python script
And here you can watch a session on python scripting within JMP with several ways from last years scripters club meeting:
Running-Python-Code-within-JSL
In addition Jarmo presented a poster at Discovery Summit Europe in Berlin this March:
JMPyFacade-Bridging-JMP-and-Python-for-Seamless-Engaging