cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar

Empty/Strange Python object after retrieving via Application Builder Script

Hi everyone, 

 

(JMP 17 Pro user) I am encountering a strange issue when attempting to pass data table objects to Python and retrieve them back into JSL, specifically while using Application Builder. 

 

As this is the first time I've used Application Builder, I wrote out a rough draft of the behavior I wanted in the app via a standard JSL script (for context, the goal is an application that allows user to select directory/file, then let JMP generate a graph for analysis). The behavior works in a standard JSL script, but does not work within the Application Builder. 

 

Here's my standalone (non-Application Builder) script:

// Initialize Python within JMP
PyConnect = Python Connect();

Names Default to Here( 1 );

// Allow user to manually pick directory and file
directory = Pick Directory ("Select a directory.");
chosen_file = Pick File("Select a file", directory);

// Open the selected file, then send to Python
dt1 = Open(chosen_file, Table Contains Column Headers(0));
Python Send(dt1);

// Close the dirty data table to save space/resources
Close(dt1, NoSave);

show(dt1, "first");

// Clean the table by removing all references to "#"
Python Submit("\[

dt1 = dt1[~dt1["Column 1"].str.contains("#")]

]\");

// Retrieve the processed table from Python and open in JMP
// Terminate Python connection
dt1 = Python Get(dt1);
Python Term();

show(dt1, "second");

And the output for this script: 

dt1 = DataTable("D424TUZ0.Inspec Meas 01");
"first";

dt1 = DataTable("dt1");
"second";

(NOT WORKING) Here's my Application Builder script:

executePress=Function({thisBox}, {Default Local},
	// This function is called when the button is pressed
	py = Python Connect();

	dt1 = Open(::file, Table Contains Column Headers(0));
	
	Close(dt1, NoSave);
	
	show(dt1, "first");
	
	// Clean the table by removing all references to "#"
	Python Submit("\[

	dt1 = dt1[~dt1["Column 1"].str.contains("#")]

	]\");
	
	dt1 = Python Get(dt1);
	Python Term();
	
	show(dt1, "second");
);

and the troubling output:

dt1 = DataTable("D424TUZ0.Inspec Meas 01");
"first";
/**********/


	dt1 = dt1[~dt1["Column 1"].str.contains("#")]

	
/**********/
dt1 = .;
"second";

TLDR: in my standalone script, after retrieving my data table back from cleaning in Python via dt1 = Python Get(dt1);, I get back an object as dt1 = DataTable("dt1");. However in JMP Application Builder script, I get dt1 = .; (which to me indicates that the object doesn't exist?). 

 

I first recognized this when I attempted to use dt1 << New Data Window; and reading this thread made me realize that I likely am not working with an object at all: https://community.jmp.com/t5/Discussions/Error-in-running-script-Send-Expects-Scriptable-Object-in-a...

 

Apologies for the long post. It's a strange error, and thank you to anybody in advance for your help on this problem!

0 REPLIES 0