Running external python script from button event

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:

Python script exist in the gateway. I set permission for folder with python script for gateway service.

How to run external python script from button event in Ignition?

It is against the forum policy to start multiple topics regarding the same subject.

1 Like

https://forum.inductiveautomation.com/faq

1 Like