FORUM CTRLX AUTOMATION
ctrlX World Partner Apps for ctrlX AUTOMATION
Dear Community User! We are updating our platform to a new
system.
Read more: Important
information on the platform change.
Tuesday - last edited Tuesday
Hi everyone,
I was experimenting with the Python runtime app and discovered that I can only run my script from the main folder activeConfiguration located at /var/snap/rexrothautomationcore/common/solutions/activeConfiguration. Even after setting all the necessary permissions for the folder and the script, it still only works from this specific directory.
Is this due to security restrictions, or am I missing something? I don't want to clutter the main folder with multiple Python files.
Thank you
Solved! Go to Solution.
Tuesday
@Felix_ ,
I think this is actually a problem with the script instance rather than the script. Is it possible you are just not returning properly from script execution? You can try adding exit(0) at the bottom of your script.
How are you executing the script? Where is the script you are trying to run located? I can execute without error at /scripts/main.py
5 hours ago
Hi @Sgilk thank you for the answer,
I changed my script with a basic helloword and i still have the error 😒.
Following this How To , i execute the script from the PLC :
I guess my path isn't good, i get this error :
and again my test.py script works in the folder /var/snap/rexroth-automationcore/common/solutions/activeConfiguration/test.py
but not in /var/snap/rexroth-automationcore/common/solutions/activeConfiguration/scripts/test.py
Except for updating the path in the PLC and creating a new instance, nothing else should change, no ?
Thank you
5 hours ago - last edited 5 hours ago
@Felix_ ,
Try using the symlink 'activeConfiguration/script/test.py'. The path you have listed is too long for a STRING(80). Both of your listed paths work in my test project attached. Set .HMI_Variables.bStartScript TRUE to execute the python script on interpreter instance Demo1.
4 hours ago - last edited 4 hours ago
Thank you, the new link works 💪. I never would have expected that the length of my path was causing the error.
One last question: with the IDE app, we can't import and use the Python runtime libraries ?
for examples :
Thanks again
3 hours ago - last edited 3 hours ago
@Felix_ ,
To use the integrated datalayer library with intellisense...
import ctrlxpy.datalayer as datalayer