Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

How to execute a python script

2018-12-28
2018-12-30
  • ziadibassem - 2018-12-28

    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?

     
  • eschwellinger

    eschwellinger - 2018-12-28

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

    BR
    Edwin

     
  • ziadibassem - 2018-12-28

    Edwin Schwellinger hat geschrieben:
    Hi,
    if you want to execute them on the Raspberry PI,
    by your IEC code, check this example here:
    l viewtopic.php?f=23&t=6247&p=19932#p19941 l
    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 ?

    IMG: Sans titre.png

     
  • eschwellinger

    eschwellinger - 2018-12-29

    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

     
  • ziadibassem - 2018-12-30

    Edwin Schwellinger hat geschrieben:
    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!

     

Log in to post a comment.