Hi,
I'm trying to launch a continuously running python script from Codesys and monitor the script status inside the Codesys runtime (running on a Linux enviroment). For now I'm testing with the below to emulate a continuously running Python script:
#test.pyi=0whileTrue:
i+=1
I'm able to successfully run the script using SysProcessExecuteCommand2 (I can see the Python process running in the task manager). However, this "freezes" the Codesys execution of the task - it sits on that command and will not continue until the Python script ends. I've proven this works by using the task monitor to kill the process, then Codesys continues on happily through the task.
What I want to do is use SysProcessCreate2 to set up the Python script as a background task and monitor the process using SysProcessGetState. This always results in the error "ERR_OPERATION_DENIED". I know that I'm able to execute commands (as above), so my config should be correct. Is SysProcessCreate2 functional on a Linux environment? Is there something in the config file I'm missing?
Here's my "working" code that uses SysProcessExecuteCommand2:
Hi,
I'm trying to launch a continuously running python script from Codesys and monitor the script status inside the Codesys runtime (running on a Linux enviroment). For now I'm testing with the below to emulate a continuously running Python script:
I'm able to successfully run the script using SysProcessExecuteCommand2 (I can see the Python process running in the task manager). However, this "freezes" the Codesys execution of the task - it sits on that command and will not continue until the Python script ends. I've proven this works by using the task monitor to kill the process, then Codesys continues on happily through the task.
What I want to do is use SysProcessCreate2 to set up the Python script as a background task and monitor the process using SysProcessGetState. This always results in the error "ERR_OPERATION_DENIED". I know that I'm able to execute commands (as above), so my config should be correct. Is SysProcessCreate2 functional on a Linux environment? Is there something in the config file I'm missing?
Here's my "working" code that uses SysProcessExecuteCommand2:
And here's the code that always results in the ERR_OPERATION_DENIED error:
Here's the relevant section from the config file at /etc/codesyscontrol/CODESYSControl.cfg:
Appreciate any support or ideas. Thanks!
Last edit: trusty-squire 2025-03-16
Maybe it is better to use the functionality of the Extension Package:
https://content.helpme-codesys.com/en/CODESYS%20Control/_rtsl_extension.html
https://content.helpme-codesys.com/en/CODESYS%20Examples/_ex_extension_package.html