Hey guys so I am trying to run a python script during codesys runtime but i am getting a lot of errors in the POU, there are red underlines, I do not understand what i am doing wrong here.
I have added the necessary libraries to run python while codesys runtime and followed the necessary steps, The python file should be copied into /var/opt/codesys and there is a log file that will also be created to log in the current time. However there seems to be a problem with my POU or the libraries are not syncing or something.
If i could get some help form you guys that would be much appreciated:
Here is the code:
Thank you for the feedback i will try it without sudo!, But i think there is something wrong with the code in itself. Which would explain why there are red lines as you can see in the attachment "POU.png".
Thank you for the feedback i will try it without sudo!, But i think there is something wrong with the code in itself. Which would explain why there are red lines as you can see in the attachment "POU.png".
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thank you but that did not work. SysFile.SysFileCopy is being called as a function, i can see it in the Call tree but the file is not being copied into the directory. I wonder why
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
sometimes we have to clean our glasses ;-) In the CODESYS Development System there are two Windows, one for declaring the variables, one for the programcode. The later is minimized in your screenshot below the line 48, I can only see one line with the red "1". Move your programcode in this window and the red underlining should disapear.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hey guys so I am trying to run a python script during codesys runtime but i am getting a lot of errors in the POU, there are red underlines, I do not understand what i am doing wrong here.
I have added the necessary libraries to run python while codesys runtime and followed the necessary steps, The python file should be copied into /var/opt/codesys and there is a log file that will also be created to log in the current time. However there seems to be a problem with my POU or the libraries are not syncing or something.
If i could get some help form you guys that would be much appreciated:
Here is the code:
Could someone please tell me what I am doing wrong here.
Last edit: ramas 2022-02-17
call it without sudo then it should work.
Last edit: eschwellinger 2022-02-17
Thank you for the feedback i will try it without sudo!, But i think there is something wrong with the code in itself. Which would explain why there are red lines as you can see in the attachment "POU.png".
Thank you for the feedback i will try it without sudo!, But i think there is something wrong with the code in itself. Which would explain why there are red lines as you can see in the attachment "POU.png".
Thank you but that did not work. SysFile.SysFileCopy is being called as a function, i can see it in the Call tree but the file is not being copied into the directory. I wonder why
sometimes we have to clean our glasses ;-) In the CODESYS Development System there are two Windows, one for declaring the variables, one for the programcode. The later is minimized in your screenshot below the line 48, I can only see one line with the red "1". Move your programcode in this window and the red underlining should disapear.
Yes thank you hapeter that was the problem, I am relatively new to codesys hence the rather amateur questions.