CODESYS - the IEC 61131-3 automation software
https://forum.codesys.com/

How to execute a python script
https://forum.codesys.com/viewtopic.php?f=21&t=9413
Page 1 of 1

Author:  ziadibassem [ Fri Dec 28, 2018 1:31 pm ]
Post subject:  How to execute a python script

I want to make a program for rasbperry pi using codesys such as it executes python scripts . So please can someone give me a simple example that I can follow?

Author:  Edwin Schwellinger [ Fri Dec 28, 2018 4:52 pm ]
Post subject:  Re: How to execute a python script

Hi,
if you want to execute them on the Raspberry PI,
by your IEC code, check this example here:
viewtopic.php?f=23&t=6247&p=19932#p19941

BR
Edwin

Author:  ziadibassem [ Fri Dec 28, 2018 6:01 pm ]
Post subject:  Re: How to execute a python script

Edwin Schwellinger wrote:
Hi,
if you want to execute them on the Raspberry PI,
by your IEC code, check this example here:
viewtopic.php?f=23&t=6247&p=19932#p19941

BR
Edwin

Thank you!
I saw that post and I could not understand this line :
SysFileCopy('/var/opt/codesys/UHScroll.py', '/var/opt/codesys/PlcLogic/Application/UHScroll.py', ADR(dwCopySize));
What are these directories :

/var/opt/codesys/UHScroll.py
/var/opt/codesys/PlcLogic/Application/UHScroll.py
?
should I do exactly like that ?

Author:  Edwin Schwellinger [ Sat Dec 29, 2018 8:18 am ]
Post subject:  Re: How to execute a python script

Hi,
the python scripts are added as external file in your CODESYS project and with the CODESYS download
of your application they will be copied to '/var/opt/codesys/PlcLogic/Application/'.
The copy to '/var/opt/codesys/' is needed because this is the directory where the runtime could call the script ( path envirnment)

Sure if you do not need this, just copy your script to a location where the runtime could call it... and do not forget to enable
the command which you allow to execute by SysProcessCommand....

BR
Edwin

Author:  ziadibassem [ Sun Dec 30, 2018 12:34 pm ]
Post subject:  Re: How to execute a python script

Edwin Schwellinger wrote:
Hi,
the python scripts are added as external file in your CODESYS project and with the CODESYS download
of your application they will be copied to '/var/opt/codesys/PlcLogic/Application/'.
The copy to '/var/opt/codesys/' is needed because this is the directory where the runtime could call the script ( path envirnment)

Sure if you do not need this, just copy your script to a location where the runtime could call it... and do not forget to enable
the command which you allow to execute by SysProcessCommand....

BR
Edwin

Thank you very much!

Page 1 of 1 All times are UTC+01:00
Powered by phpBB® Forum Software © phpBB Limited
https://www.phpbb.com/