cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
hogi
Level XIII

Python & JSL function

From Python in JMP: dataframe column to datatable column best practices and computation speed implication... I just learned about this nice new function: 

import jmp

jmp.globals['pi'] = 3.1415927
jmp.globals['bB'] = 'Bumble Bee'
print( jmp.globals.items() )

to define variables in the JSL namespace - like a push version of Python Get()

 

There are some restrictions. E.g. , at the moment jmp.globals doesn't know JSL functions:

::f= function({x},x);
x="hello";
y=5;
z={1,2,3};
aa= associative Array({1,2});
Python Submit("
import jmp
print(jmp.globals)");

the response:

hogi_0-1762428834857.png

 

 

Maybe a related issue? :
The attempt to create a function via run_jsl with this JSL code:

import jmp
jmp.run_jsl('x="hello";Caption(x)') # OK
jmp.run_jsl('f= function({x},x)')   # crash

...  leads to a crash!?!

when you run the code line by line, you will get this error message:

hogi_2-1762425301770.png

 

3 REPLIES 3

Re: Python & JSL function

A bug.  JMP 19?

I get a different error message on my machine but it appears that the run_jsl() is acting as if an eval(f = function({x},x)) is occurring rather just the assignment.

Paul_Nelson_0-1762441906483.png

I was able to recreate what I was seeing from Python, with just running from JSL.

Re: Python & JSL function

Yes, @hogi is running JMP 19.0.1. He sent an email to support asking if this was a known bug. 

hogi
Level XIII

Re: Python & JSL function

Same issue with JMP19 and JMP19.0.1 (Windows version).
With JMP 18, there is no issue.


Interesting that 
eval(f = function({x},x))
is different from 
f = function({x},x).
So, it evaluates the argument before evaluating the return value of the argument?

Eval(print(1);Parse("print(2)"));


Significantly different:

 

  • with the Python code, JMP crashes on my system (maybe there is a difference between Win and Mac?)

  • with eval(f = function({x},x)) JMP shows a JMP alert and continues alive:

hogi_0-1762460875004.png

Recommended Articles