I was hoping to integrate python into JMP JSL (version 17.2). I need to do some complex nesting but I can't even seem to do something simple. The scripting index for Python Submit showcases python generating a variable and then it being pulled into JSL using Python Get.
//scripting index code
Names Default To Here( 1 );
Python Init();
Python Submit( "\[
str = 'The quick brown fox jumps over the lazy dog';
a = 200;
]\");
getStr = Python Get( str );
getNum = Python Get( a );
Show( getStr, getNum);
Python Term();
I was hoping to start with something simple like this and then advance to something more advanced:
Python Submit("\[
for i in range(10):;
if i == 6:;
print(i);
]\");I was expecting the terminal to solely print a six however after running the script the result was a bit bizarre.
//Terminal Output<BR />/**********/<BR /><BR />for i in range(10):;<BR />if i == 6:;<BR />print(i);<BR />/**********/
I have tested some more and learned that a couple of things work. But I still can't get nested loops to work.
//Code that seemingly works
Python Submit("print('Hello World')");
Python Submit("for i in range(10): print(i); print(i);");
//Code that doesn't work for some reason
Python Submit("for i in range(10):; if i == 6; print(i)");
Python Submit("for i in range(10): if i == 6: print(i)");<BR />Python Submit("for i in range(10): if i == 6:; print(i););If anyone has any advice it would be much appreciated.
Here is the Submit structures in the JMP 17 interface to Python that I found that work
Names Default To Here( 1 );
Python Init();
Python Submit("\[
for i in range(11):
if i == 6:
print(i)
print(i)
]\");
Python Submit("i=6
if i == 6: print(i); print('i is 6')
");If you are able to update to JMP18 you will save yourself from a lot of possible headache due to the new way of handling Python in JMP.
Looks like you overlooked the indentations needed.
Python Submit("\[
for i in range(10):
if i == 6:
print(i)
]\"); //6 (then 0 when Python is successfully terminated)I didn't realize that indentation had such a large impact in jmp. Thanks for the help!
It doesn't have an impact in JMP but it does have an impact in Python (you are running Python code not JSL).