<?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: How to execute python helloworld.py in SAS Enterprise Guide in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/How-to-execute-python-helloworld-py-in-SAS-Enterprise-Guide/m-p/336209#M9925</link>
    <description>&lt;P&gt;And as &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/45151"&gt;@RW9&lt;/a&gt; has suggested, also use the full path to your python binary, for security reasons.&lt;/P&gt;</description>
    <pubDate>Mon, 27 Feb 2017 14:36:49 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2017-02-27T14:36:49Z</dc:date>
    <item>
      <title>How to execute python helloworld.py in SAS Enterprise Guide</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-to-execute-python-helloworld-py-in-SAS-Enterprise-Guide/m-p/336191#M9921</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; I have a helloworld.py python script and I want to execute it in SAS Enterprise Guide, how could I do it and see the "Hello World!" output?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; My SAS code in EG is as follow, but it did not work:( Please help me and let me know how I can revise the code and see the "Hello World!" output?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; test;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;x&lt;/FONT&gt; &lt;FONT color="#800080" face="Courier New" size="3"&gt;"cd /home/Jade"&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;x&lt;/FONT&gt; &lt;FONT color="#800080" face="Courier New" size="3"&gt;"python helloworld.py"&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;output&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;Run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;Jade&lt;/P&gt;&lt;BR /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/13498i2F22E2F58B58B215/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="helloworld.PNG" title="helloworld.PNG" /&gt;</description>
      <pubDate>Mon, 27 Feb 2017 14:17:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-to-execute-python-helloworld-py-in-SAS-Enterprise-Guide/m-p/336191#M9921</guid>
      <dc:creator>Jade_SAS</dc:creator>
      <dc:date>2017-02-27T14:17:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to execute python helloworld.py in SAS Enterprise Guide</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-to-execute-python-helloworld-py-in-SAS-Enterprise-Guide/m-p/336195#M9922</link>
      <description>&lt;P&gt;You will need to be more specific about "&lt;SPAN&gt;it did not work&lt;/SPAN&gt;". &amp;nbsp;&lt;/P&gt;
&lt;P&gt;First, I would include full paths to the relevant parts, it looks like you have EG installed on a unix system, I am not realy familiar with that setup. &amp;nbsp;In Windows if Python was installed in c:\python and the python script in c:\myscripts then the X command would look:&lt;/P&gt;
&lt;P&gt;x '"c:\python\python.exe" "c:\myscripts\helloworld.py"';&lt;/P&gt;
&lt;P&gt;So that may be a problem for you - i.e. it isn't finding one or the other. &amp;nbsp;It may also be that you don't have access rights. &amp;nbsp;It could also be that the script did run, but the output went so quickly you didn't see it. &amp;nbsp;You could try putting in your python code a promtp to get a response, something like:&lt;/P&gt;
&lt;P&gt;"Press any key to continue"&lt;/P&gt;
&lt;P&gt;This way the window will stay active until a key press.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Further information is required really.&lt;/P&gt;</description>
      <pubDate>Mon, 27 Feb 2017 14:23:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-to-execute-python-helloworld-py-in-SAS-Enterprise-Guide/m-p/336195#M9922</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-02-27T14:23:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to execute python helloworld.py in SAS Enterprise Guide</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-to-execute-python-helloworld-py-in-SAS-Enterprise-Guide/m-p/336198#M9923</link>
      <description>&lt;P&gt;X is a global statement that is executed immediately when encountered in code. So your two X statements are dealt with while the data step is compiled, not while it runs.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To catch output from external commands, use filename pipe:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename oscmd pipe "python /home/Jade/helloworld.py 2&amp;gt;&amp;amp;1";

data test;
infile oscmd truncover;
input infile $100.;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The 2&amp;gt;&amp;amp;1 construct redirects stderr output to stdout, so everything (output and/or error messages) can be read from the pipe.&lt;/P&gt;
&lt;P&gt;To write output into the SAS log, do&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
infile oscmd;
input;
put _infile_;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 27 Feb 2017 14:27:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-to-execute-python-helloworld-py-in-SAS-Enterprise-Guide/m-p/336198#M9923</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-02-27T14:27:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to execute python helloworld.py in SAS Enterprise Guide</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-to-execute-python-helloworld-py-in-SAS-Enterprise-Guide/m-p/336202#M9924</link>
      <description>&lt;P&gt;1. Make sure the command works from the command line.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2. Make sure x command is enabled in EG - usually turned off by default.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Feb 2017 14:33:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-to-execute-python-helloworld-py-in-SAS-Enterprise-Guide/m-p/336202#M9924</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-02-27T14:33:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to execute python helloworld.py in SAS Enterprise Guide</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-to-execute-python-helloworld-py-in-SAS-Enterprise-Guide/m-p/336209#M9925</link>
      <description>&lt;P&gt;And as &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/45151"&gt;@RW9&lt;/a&gt; has suggested, also use the full path to your python binary, for security reasons.&lt;/P&gt;</description>
      <pubDate>Mon, 27 Feb 2017 14:36:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-to-execute-python-helloworld-py-in-SAS-Enterprise-Guide/m-p/336209#M9925</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-02-27T14:36:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to execute python helloworld.py in SAS Enterprise Guide</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-to-execute-python-helloworld-py-in-SAS-Enterprise-Guide/m-p/336214#M9926</link>
      <description>&lt;P&gt;Thank you all! The python script worls in linux command and the X windows is eabled in SAS.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What KurtBremser suggested worked!!! Finally I saw the output in EG.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Feb 2017 14:47:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-to-execute-python-helloworld-py-in-SAS-Enterprise-Guide/m-p/336214#M9926</guid>
      <dc:creator>Jade_SAS</dc:creator>
      <dc:date>2017-02-27T14:47:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to execute python helloworld.py in SAS Enterprise Guide</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-to-execute-python-helloworld-py-in-SAS-Enterprise-Guide/m-p/369354#M11144</link>
      <description>&lt;P&gt;Hi, you can run the x cmd&amp;nbsp;directly without data step:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;x&lt;/FONT&gt; &lt;FONT face="Courier New" size="3" color="#800080"&gt;"cd /home/Jade"&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;x&lt;/FONT&gt; &lt;FONT face="Courier New" size="3" color="#800080"&gt;"python helloworld.py"&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jun 2017 22:14:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-to-execute-python-helloworld-py-in-SAS-Enterprise-Guide/m-p/369354#M11144</guid>
      <dc:creator>sotojcr</dc:creator>
      <dc:date>2017-06-21T22:14:15Z</dc:date>
    </item>
  </channel>
</rss>

