<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: JMP Pro 15 Generate Python Code from Journal in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/JMP-Pro-15-Generate-Python-Code-from-Journal/m-p/237136#M46822</link>
    <description>&lt;P&gt;I was able to reproduce the problem you're seeing just as you suggest, by putting that script in a script button in the Journal.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think that&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/3734"&gt;@nascif_jmp&lt;/a&gt;&amp;nbsp;has the best suggestion to contact Tech Support, &lt;A href="mailto:support@jmp.com" target="_self"&gt;support@jmp.com&lt;/A&gt;. They'll be in the best position to diagnose the problem and recommend a solution.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Post back here with anything you find out from them.&lt;/P&gt;</description>
    <pubDate>Tue, 03 Dec 2019 20:50:48 GMT</pubDate>
    <dc:creator>Jeff_Perkinson</dc:creator>
    <dc:date>2019-12-03T20:50:48Z</dc:date>
    <item>
      <title>JMP Pro 15 Generate Python Code from Journal</title>
      <link>https://community.jmp.com/t5/Discussions/JMP-Pro-15-Generate-Python-Code-from-Journal/m-p/237069#M46803</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Was trying to run Generate Python Code from jsl script. It ran fine. When I placed the script in a journal script button the python code was not generated.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I tried the example from the help with the same results.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Am using jmp pro15.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jmp 15 journal error.jpg" style="width: 999px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/20507iAFB23F2348F0D46A/image-size/large?v=v2&amp;amp;px=999" role="button" title="jmp 15 journal error.jpg" alt="jmp 15 journal error.jpg" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jmp15 help.jpg" style="width: 804px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/20508i33DC7EE7C1E369BC/image-size/large?v=v2&amp;amp;px=999" role="button" title="jmp15 help.jpg" alt="jmp15 help.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Dec 2019 20:47:59 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JMP-Pro-15-Generate-Python-Code-from-Journal/m-p/237069#M46803</guid>
      <dc:creator>RonB</dc:creator>
      <dc:date>2019-12-03T20:47:59Z</dc:date>
    </item>
    <item>
      <title>Re: JMP Pro 15 Generate Python Code from Journal</title>
      <link>https://community.jmp.com/t5/Discussions/JMP-Pro-15-Generate-Python-Code-from-Journal/m-p/237083#M46808</link>
      <description>&lt;P&gt;What object are you sending the "Generate Python Code" message to, when the user clicks on the Journal button?&lt;/P&gt;
&lt;P&gt;It should be a valid Formula Depot reference. My guess is that the message is being sent to another type of object, and being ignored.&lt;/P&gt;
&lt;P&gt;Then the variable holding what would be the Python code is empty, which results in an error when trying to save it to a text file.&lt;/P&gt;
&lt;P&gt;So another thing you can try is to add a 'Show(py_code)' statement to your code. Always double-check the content of your variables!&lt;/P&gt;
&lt;P&gt;I would also suggest working on this with tech support, as you will be able to share your code, data, etc.&lt;/P&gt;
&lt;P&gt;That will help a lot with figuring out what is going on.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Dec 2019 15:17:52 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JMP-Pro-15-Generate-Python-Code-from-Journal/m-p/237083#M46808</guid>
      <dc:creator>nascif_jmp</dc:creator>
      <dc:date>2019-12-03T15:17:52Z</dc:date>
    </item>
    <item>
      <title>Re: JMP Pro 15 Generate Python Code from Journal</title>
      <link>https://community.jmp.com/t5/Discussions/JMP-Pro-15-Generate-Python-Code-from-Journal/m-p/237103#M46816</link>
      <description>&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, as I wrote before, I tried it with the sample code from jmp help. It works when ran from a script window but when executed from a journal script button, it seems not to generate the Python code (as a string).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's the help sample code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
fd = Formula Depot();
dt = Open( "$SAMPLE_DATA/Iris.jmp" );
md = dt &amp;lt;&amp;lt; Run Script( "Nominal Logistic" );
predictor = md &amp;lt;&amp;lt; Publish Probability Formulas;
// Save code to string 
py_code = fd &amp;lt;&amp;lt;
Generate Python Code(
	Formulas( predictor ),
	No Editor
);
// shortcut using predictor reference
// py_code = predictor &amp;lt;&amp;lt; Generate Python Code(No Editor);
Save Text File( "$TEMP\logist.py", py_code );
// Open code in editor window
fd &amp;lt;&amp;lt; Generate Python Code( Formulas( predictor ) );    &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 03 Dec 2019 17:58:14 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JMP-Pro-15-Generate-Python-Code-from-Journal/m-p/237103#M46816</guid>
      <dc:creator>RonB</dc:creator>
      <dc:date>2019-12-03T17:58:14Z</dc:date>
    </item>
    <item>
      <title>Re: JMP Pro 15 Generate Python Code from Journal</title>
      <link>https://community.jmp.com/t5/Discussions/JMP-Pro-15-Generate-Python-Code-from-Journal/m-p/237136#M46822</link>
      <description>&lt;P&gt;I was able to reproduce the problem you're seeing just as you suggest, by putting that script in a script button in the Journal.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think that&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/3734"&gt;@nascif_jmp&lt;/a&gt;&amp;nbsp;has the best suggestion to contact Tech Support, &lt;A href="mailto:support@jmp.com" target="_self"&gt;support@jmp.com&lt;/A&gt;. They'll be in the best position to diagnose the problem and recommend a solution.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Post back here with anything you find out from them.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Dec 2019 20:50:48 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JMP-Pro-15-Generate-Python-Code-from-Journal/m-p/237136#M46822</guid>
      <dc:creator>Jeff_Perkinson</dc:creator>
      <dc:date>2019-12-03T20:50:48Z</dc:date>
    </item>
    <item>
      <title>Re: JMP Pro 15 Generate Python Code from Journal</title>
      <link>https://community.jmp.com/t5/Discussions/JMP-Pro-15-Generate-Python-Code-from-Journal/m-p/237137#M46823</link>
      <description>&lt;P&gt;Thanks for checking,&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/6878"&gt;@Jeff_Perkinson&lt;/a&gt;.&lt;/P&gt;
&lt;P&gt;I was also able to reproduce the issue. The "No Editor" option is being ignored when the call to generate python is made from the journal. It is *always* launching a script editor, as it used to do in JMP 13.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Which reminded me of how I used to test this code back then. So I used the same technique to write a workaround for your script. It isn't very pretty, but it might be enough to get you going until we can come up with a fix. In any case, please get in touch with tech support.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
fd = Formula Depot();
Show(fd);
dt = Open( "$SAMPLE_DATA/Iris.jmp" );
md = dt &amp;lt;&amp;lt; Run Script( "Nominal Logistic" );
predictor = md &amp;lt;&amp;lt; Publish Probability Formulas;
&lt;BR /&gt;// Save code to string - doesn't work inside Journals
// py_code = fd &amp;lt;&amp;lt; Generate Python Code(Formulas( predictor ), "No Editor");

// Get a handle to editor window and retrieve code from it
// Requires the title of the script as argument, which is based on 
// model name and data set.
win = Window("Fit_Nominal_Logistic_Species");
py_code = win[scriptbox(1)] &amp;lt;&amp;lt; get text;
Save Text File( "$TEMP\logist_J.py", py_code );
Open("$TEMP\logist_J.py");
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 03 Dec 2019 21:01:26 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JMP-Pro-15-Generate-Python-Code-from-Journal/m-p/237137#M46823</guid>
      <dc:creator>nascif_jmp</dc:creator>
      <dc:date>2019-12-03T21:01:26Z</dc:date>
    </item>
    <item>
      <title>Re: JMP Pro 15 Generate Python Code from Journal</title>
      <link>https://community.jmp.com/t5/Discussions/JMP-Pro-15-Generate-Python-Code-from-Journal/m-p/237159#M46828</link>
      <description>&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The work around didn' work either as script window or from a journal. Getting the same error message.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In any event, I opened a ticket at tech support.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="04-12-2019 7-54-25.jpg" style="width: 937px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/20513iDD9E0F040FA9FA59/image-size/large?v=v2&amp;amp;px=999" role="button" title="04-12-2019 7-54-25.jpg" alt="04-12-2019 7-54-25.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Dec 2019 05:58:16 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JMP-Pro-15-Generate-Python-Code-from-Journal/m-p/237159#M46828</guid>
      <dc:creator>RonB</dc:creator>
      <dc:date>2019-12-04T05:58:16Z</dc:date>
    </item>
    <item>
      <title>Re: JMP Pro 15 Generate Python Code from Journal</title>
      <link>https://community.jmp.com/t5/Discussions/JMP-Pro-15-Generate-Python-Code-from-Journal/m-p/237265#M46847</link>
      <description>&lt;P&gt;Apologies. I was testing the code line by line and forgot to do a final test.&lt;/P&gt;
&lt;P&gt;If you look carefully you will see that I had commented out the line that generates the Python code, so there was no editor window to capture by title and retrieve the code from. The following script corrects that mistake. I also attached a journal that shows it being executed from a button click.&lt;/P&gt;
&lt;P&gt;Thanks for sending this to tech support.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
fd = Formula Depot();
Show(fd);
dt = Open( "$SAMPLE_DATA/Iris.jmp" );
md = dt &amp;lt;&amp;lt; Run Script( "Nominal Logistic" );
predictor = md &amp;lt;&amp;lt; Publish Probability Formulas;

// Save code to string - doesn't work inside Journals
// py_code = fd &amp;lt;&amp;lt; Generate Python Code(Formulas( predictor ), "No Editor");

// just generate to editor instead
fd &amp;lt;&amp;lt; Generate Python Code(Formulas( predictor ));

// Get a handle to editor window and retrieve code from it
// Requires the title of the script as argument, which is based on 
// model name and data set.
win = Window("Fit_Nominal_Logistic_Species");
py_code = win[scriptbox(1)] &amp;lt;&amp;lt; get text;
Save Text File( "$TEMP\logist_J.py", py_code );
Open("$TEMP\logist_J.py");&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 04 Dec 2019 14:53:58 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JMP-Pro-15-Generate-Python-Code-from-Journal/m-p/237265#M46847</guid>
      <dc:creator>nascif_jmp</dc:creator>
      <dc:date>2019-12-04T14:53:58Z</dc:date>
    </item>
    <item>
      <title>Re: JMP Pro 15 Generate Python Code from Journal</title>
      <link>https://community.jmp.com/t5/Discussions/JMP-Pro-15-Generate-Python-Code-from-Journal/m-p/237380#M46873</link>
      <description>&lt;P&gt;Workaround worked fine.&lt;/P&gt;&lt;P&gt;R&amp;amp;D is working on a defect.&lt;/P&gt;&lt;P&gt;Many thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Dec 2019 06:54:12 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JMP-Pro-15-Generate-Python-Code-from-Journal/m-p/237380#M46873</guid>
      <dc:creator>RonB</dc:creator>
      <dc:date>2019-12-05T06:54:12Z</dc:date>
    </item>
  </channel>
</rss>

