<?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: Execute Python code within SAS Enterprise Guide in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Execute-Python-code-within-SAS-Enterprise-Guide/m-p/839882#M332057</link>
    <description>&lt;P&gt;Thanks much Chris for your help. Appreciate it. It's working for me.&lt;/P&gt;</description>
    <pubDate>Fri, 21 Oct 2022 10:33:25 GMT</pubDate>
    <dc:creator>Vemula</dc:creator>
    <dc:date>2022-10-21T10:33:25Z</dc:date>
    <item>
      <title>Execute Python code within SAS Enterprise Guide</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Execute-Python-code-within-SAS-Enterprise-Guide/m-p/839311#M331864</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using SAS Enterprise Guide to execute Python code. We have SAS 9.4M6. I have used below ways but are unsuccessful. Could you please help me with it?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Python Code:&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;import&lt;/SPAN&gt;&lt;SPAN&gt; tempfile&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;import&lt;/SPAN&gt;&lt;SPAN&gt; errno&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;def&lt;/SPAN&gt; &lt;SPAN&gt;isWritable&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;path&lt;/SPAN&gt;&lt;SPAN&gt;&lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;try&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; testfile = tempfile.TemporaryFile(&lt;/SPAN&gt;&lt;SPAN&gt;dir&lt;/SPAN&gt;&lt;SPAN&gt; = path)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; testfile.close()&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;except&lt;/SPAN&gt; &lt;SPAN&gt;OSError&lt;/SPAN&gt; &lt;SPAN&gt;as&lt;/SPAN&gt;&lt;SPAN&gt; e:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN&gt; e.errno == errno.EACCES: &amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;# 13&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;return&lt;/SPAN&gt; &lt;SPAN&gt;False&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; e.filename = path&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;raise&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;return&lt;/SPAN&gt; &lt;SPAN&gt;True&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;print&lt;/SPAN&gt;&lt;SPAN&gt;(isWritable(&lt;/SPAN&gt;&lt;SPAN&gt;"/path/project"&lt;/SPAN&gt;&lt;SPAN&gt;))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;1:&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;proc fcmp;&lt;BR /&gt;declare object py(python);&lt;BR /&gt;rc = py.infile("/path/get_d_list.py");&lt;BR /&gt;put rc=;&lt;BR /&gt;rc = py.publish();&lt;BR /&gt;rc = py.call("isWritable", "/path/vyashoda");&lt;BR /&gt;/* Result = py.results["MyOutputKey"];*/&lt;BR /&gt;/* put Result=;*/&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;2:&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;x "python3 /path/get_d_list.py";&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;3:&lt;/STRONG&gt;&lt;/U&gt;&lt;BR /&gt;data _null_;&lt;BR /&gt;call system ('python3 /path/get_d_list.py');&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;4:&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;%macro pwdls;&lt;BR /&gt;%sysexec %str(pwd;python3 /path/get_d_list.py);&lt;BR /&gt;%mend pwdls;&lt;BR /&gt;%pwdls;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Oct 2022 08:11:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Execute-Python-code-within-SAS-Enterprise-Guide/m-p/839311#M331864</guid>
      <dc:creator>Vemula</dc:creator>
      <dc:date>2022-10-19T08:11:46Z</dc:date>
    </item>
    <item>
      <title>Re: Execute Python code within SAS Enterprise Guide</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Execute-Python-code-within-SAS-Enterprise-Guide/m-p/839820#M332024</link>
      <description>&lt;P&gt;I never used python in SAS, but you should use&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;filename CMD pipe 'python3 /path/get_d_list.py 2&amp;gt;&amp;amp;1';&lt;BR /&gt;data _null_;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; infile CMD;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; input;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; put _infile_;&lt;BR /&gt;&lt;SPAN&gt;run;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;instead of&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;data _null_;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;call system ('python3 /path/get_d_list.py');&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;run;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;to see OS messages.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Oct 2022 00:43:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Execute-Python-code-within-SAS-Enterprise-Guide/m-p/839820#M332024</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2022-10-21T00:43:23Z</dc:date>
    </item>
    <item>
      <title>Re: Execute Python code within SAS Enterprise Guide</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Execute-Python-code-within-SAS-Enterprise-Guide/m-p/839882#M332057</link>
      <description>&lt;P&gt;Thanks much Chris for your help. Appreciate it. It's working for me.&lt;/P&gt;</description>
      <pubDate>Fri, 21 Oct 2022 10:33:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Execute-Python-code-within-SAS-Enterprise-Guide/m-p/839882#M332057</guid>
      <dc:creator>Vemula</dc:creator>
      <dc:date>2022-10-21T10:33:25Z</dc:date>
    </item>
  </channel>
</rss>

