<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to Call Pythonscript in Codesy 3.5 PLC code</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/224a8fee26/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Engineering/thread/224a8fee26/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Engineering/thread/224a8fee26/</id><updated>2020-12-20T09:20:17.354000Z</updated><subtitle>Recent posts to Call Pythonscript in Codesy 3.5 PLC code</subtitle><entry><title>Call Pythonscript in Codesy 3.5 PLC code</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/224a8fee26/?limit=25#1ac5/7fe5" rel="alternate"/><published>2020-12-20T09:20:17.354000Z</published><updated>2020-12-20T09:20:17.354000Z</updated><author><name>dumpfbacke</name><uri>https://forge.codesys.com/u/dumpfbacke/</uri></author><id>https://forge.codesys.com55293d765f6b2f332e15aca921e4b1ab8ec5b07f</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;hi, &lt;br/&gt;
i tried now based to your sample run python script.&lt;br/&gt;
My testpythonscript opens the broswer with goolgewebsite to see simple wether it works.&lt;/p&gt;
&lt;p&gt;i allowed commands in&lt;br/&gt;
CODESYSControl_User.cfg and CODESYSControl.cfg&lt;br/&gt;
with&lt;br/&gt;
&lt;span&gt;[SysProcess]&lt;/span&gt; &lt;br/&gt;
Command=AllowAll&lt;/p&gt;
&lt;p&gt;i am not sure is runtime pi or root?&lt;/p&gt;
&lt;p&gt;I also made thr sccriptfile executable.&lt;br/&gt;
i also copied the file int /var/opt/codesys similar your sample project.&lt;/p&gt;
&lt;p&gt;my coding is this:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="nv"&gt;co&lt;/span&gt;&lt;span class="o"&gt;//&lt;/span&gt; &lt;span class="nv"&gt;Aktuelle&lt;/span&gt; &lt;span class="nv"&gt;CPU&lt;/span&gt; &lt;span class="nv"&gt;Frequenz&lt;/span&gt; &lt;span class="nv"&gt;lesen&lt;/span&gt;
&lt;span class="o"&gt;//&lt;/span&gt;&lt;span class="nv"&gt;command1&lt;/span&gt;:&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;vcgencmd measure_clock arm&lt;/span&gt;&lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="c1"&gt;;&lt;/span&gt;
&lt;span class="o"&gt;//&lt;/span&gt;&lt;span class="nv"&gt;command1&lt;/span&gt;:&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;sudo python mytest.py&lt;/span&gt;&lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="c1"&gt;;&lt;/span&gt;
&lt;span class="o"&gt;//&lt;/span&gt;&lt;span class="nv"&gt;command1&lt;/span&gt;:&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;sudo python /home/pi/mytest.py&lt;/span&gt;&lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="c1"&gt;;&lt;/span&gt;
&lt;span class="o"&gt;//&lt;/span&gt;&lt;span class="nv"&gt;command1&lt;/span&gt;:&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;sudo python /var/opt/codesys/mytest.py&lt;/span&gt;&lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="c1"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;command1&lt;/span&gt;:&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;python /var/opt/codesys/mytest.py&lt;/span&gt;&lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="c1"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;IF&lt;/span&gt; &lt;span class="nv"&gt;bDummyBool&lt;/span&gt; &lt;span class="k"&gt;THEN&lt;/span&gt;
    &lt;span class="nv"&gt;SysProcess&lt;/span&gt;.&lt;span class="nv"&gt;SysProcessExecuteCommand2&lt;/span&gt;&lt;span class="ss"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;pszCommand&lt;/span&gt;:&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;command1&lt;/span&gt;, &lt;span class="nv"&gt;pszStdOut&lt;/span&gt;:&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;stdout1&lt;/span&gt;, &lt;span class="nv"&gt;udiStdOutLen&lt;/span&gt;:&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;SIZEOF&lt;/span&gt;&lt;span class="ss"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;stdout1&lt;/span&gt;&lt;span class="ss"&gt;)&lt;/span&gt;,&lt;span class="nv"&gt;pResult&lt;/span&gt; :&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;ADR&lt;/span&gt;&lt;span class="ss"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;Result&lt;/span&gt;&lt;span class="ss"&gt;))&lt;/span&gt;&lt;span class="c1"&gt;;&lt;/span&gt;
    &lt;span class="o"&gt;//&lt;/span&gt;&lt;span class="nv"&gt;bDummyBool&lt;/span&gt; :&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;FALSE&lt;/span&gt;&lt;span class="c1"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;END_IF&lt;/span&gt;&lt;span class="c1"&gt;;de&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;doesn not work, what i am doing wrong?&lt;br/&gt;
Can you please amser once more&lt;br/&gt;
Thanks&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Call Pythonscript in Codesy 3.5 PLC code</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/224a8fee26/?limit=250#572c/a848/e9f7" rel="alternate"/><published>2020-12-19T10:45:47.860000Z</published><updated>2020-12-19T10:45:47.860000Z</updated><author><name>h-hermsen</name><uri>https://forge.codesys.com/u/hermsen/</uri></author><id>https://forge.codesys.combb710506540be0e5d75a36d0598e38fcca671a06</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;I do know this: &lt;a href="https://forge.codesys.com/tol/scripting/home/Home/"&gt;https://forge.codesys.com/tol/scripting/home/Home/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Hope that helps&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Call Pythonscript in Codesy 3.5 PLC code</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/224a8fee26/?limit=25#1cb9" rel="alternate"/><published>2020-12-19T08:41:13.606000Z</published><updated>2020-12-19T08:41:13.606000Z</updated><author><name>eschwellinger</name><uri>https://forge.codesys.com/u/eschwellinger/</uri></author><id>https://forge.codesys.comd4d7d3650b7de298d9567364945f526c00f4fe53</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;.. in the same section (old examples) there is a python OPC UA client example to&lt;br/&gt;
read symbols from the plc runtime&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Call Pythonscript in Codesy 3.5 PLC code</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/224a8fee26/?limit=25#572c/a848" rel="alternate"/><published>2020-12-19T05:28:55.068000Z</published><updated>2020-12-19T05:28:55.068000Z</updated><author><name>dumpfbacke</name><uri>https://forge.codesys.com/u/dumpfbacke/</uri></author><id>https://forge.codesys.com2ba4d6d1bf75f9aadac0abd11871899b9e52b430</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;hi, &lt;br/&gt;
my idea is to run a pythonprogram to read/write data into sql database.&lt;br/&gt;
Fisrt step for me is try to execute pythonscript.&lt;br/&gt;
Second step try to read tags vom codesysruntime with python, any idea wether this iss possible?&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Call Pythonscript in Codesy 3.5 PLC code</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/224a8fee26/?limit=25#1ac5" rel="alternate"/><published>2020-12-18T19:41:00.280000Z</published><updated>2020-12-18T19:41:00.280000Z</updated><author><name>eschwellinger</name><uri>https://forge.codesys.com/u/eschwellinger/</uri></author><id>https://forge.codesys.comaee5cc4ec2908ec84311b5c2d36746110caa78cd</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;check the old example section:&lt;br/&gt;
&lt;a href="https://forge.codesys.com/forge/talk/Runtime/thread/04361f89ec/?limit=25#333d"&gt;https://forge.codesys.com/forge/talk/Runtime/thread/04361f89ec/?limit=25#333d&lt;/a&gt;&lt;br/&gt;
more in detail here:&lt;br/&gt;
&lt;a href="https://forge.codesys.com/forge/talk/Runtime/thread/04361f89ec/?limit=25&amp;amp;page=1#d08c"&gt;https://forge.codesys.com/forge/talk/Runtime/thread/04361f89ec/?limit=25&amp;amp;page=1#d08c&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Call Pythonscript in Codesy 3.5 PLC code</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/224a8fee26/?limit=250#572c" rel="alternate"/><published>2020-12-18T16:16:39.858000Z</published><updated>2020-12-18T16:16:39.858000Z</updated><author><name>h-hermsen</name><uri>https://forge.codesys.com/u/hermsen/</uri></author><id>https://forge.codesys.com786aeeb57718734bfe0b752aaac82a854da23532</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;It can be done if your Runtime is linux based and you have open access to the linux part of the OS. Otherwise it cannot be done. Besides that it can be done, why do you want to do that? &lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Call Pythonscript in Codesy 3.5 PLC code</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/224a8fee26/?limit=25#fce0" rel="alternate"/><published>2020-12-17T06:44:40.150000Z</published><updated>2020-12-17T06:44:40.150000Z</updated><author><name>dumpfbacke</name><uri>https://forge.codesys.com/u/dumpfbacke/</uri></author><id>https://forge.codesys.com78684a26b30719de65e67a24cc2c886e964f301c</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;hi, &lt;/p&gt;
&lt;p&gt;its possible to call a pythonscript in Codesys 3.5 PLC code?&lt;/p&gt;
&lt;p&gt;Thanks, Dumpfbacke&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>