Hello everyone, I write python3 script, which connect to IP camera, take a screenshot and saves the photo to a folder on the disk. I want to run this external python script from button event in perspective view in Ignition. I am trying two external script calls:
1)
system.util.execute(['C:/Program Files/Python311/python.exe', 'C:/Praca/Testy kamer/test.py'])
2)
import subprocess
pythonPath = "C:/Program Files/Python311/python.exe"
scriptPath = "C:/Praca/Testy kamer/test.py"
result = subprocess.check_output([pythonPath, scriptPath])
When I run these calls from the script console in ignition - the script executes correctly and the image is written to disk.
But if I run these calls from button event on click - external script does not execute.
When I click button in preview mode I am getting such error:
From what I have tried on this forum, python scripts must be stored in the gateway to be ran, and in order to run those scripts, the python exe needs to be stored in the gateway as well. Because you are using python 3, you would have to install python 3 in the gateway. I still havent figured out how to do this.
This is only true for the Perspective Module or Tags. The Vision Module, which does have access to the client machine can execute code on that machine. Weather or not it should is a different question.