I am currently busy with a project where I need to run a python script from a condition/trigger in my SoMachine (CoDeSys) project.
I was wondering if anyone could maybe inform me on a way to execute the file in Structured Text. Also I added the python file in my program (see attached). Keep in mind that it needs to execute while running on the PLC and the script might be executed multiple times in the program.
I would appreciate any help or advice.
Kind regards
Markus Oosthuizen
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am also trying to run a python script inside a schneider m251 plc but haven't figured how yet. The script runs perfectly on my pc.
Can anyone give a tip?
The python script is the following:
from twilio.rest import Client
account_sid = 'xxxxxxxxx'
auth_token = 'xxxxxxx'
client = Client(account_sid, auth_token)
Good day All,
I am currently busy with a project where I need to run a python script from a condition/trigger in my SoMachine (CoDeSys) project.
I was wondering if anyone could maybe inform me on a way to execute the file in Structured Text. Also I added the python file in my program (see attached). Keep in mind that it needs to execute while running on the PLC and the script might be executed multiple times in the program.
I would appreciate any help or advice.
Kind regards
Markus Oosthuizen
I am also trying to run a python script inside a schneider m251 plc but haven't figured how yet. The script runs perfectly on my pc.
Can anyone give a tip?
The python script is the following:
from twilio.rest import Client
account_sid = 'xxxxxxxxx'
auth_token = 'xxxxxxx'
client = Client(account_sid, auth_token)
message = client.messages \
.create(
body='Alarm',
from_='xxx',
to='xxxx'
)
Did he do it?
I want to do the same, and I can not find the solution
Hi agrobot.
Take a look at the example for the Raspberry Pi and SenseHAT:
https://forum.codesys.com/viewtopic.php?f=23&t=6247&p=19932#p19941
This works because the Raspberry Pi has the python interpreter installed. If the PLC has not python interpreter it does not work.
BR
Martin
I have doubts about how to call my python pwm script in the program, I did not have to do it, think you could help me
you could try building the script as a .exe using pyinstaller and calling this as a process using the PLC?