Hello,
To work around the impossibility of calling some useful Python libraries inside Ignition:
I’d like to know if there is a way to, inside Ignition, call a Python file outside of Ignition to run the code with the libraries that I want, and then sending it back to Ignition in maybe a text format. Do anyone know if that would work / be possible?
Thanks in advance!
I did something similar for one project. I’ve built a program for a high-speed camera in C++.
The sequence was:
- A script inside ignition that executes the C++ program
def execute():
import subprocess
encoding = 'latin1'
cmds = ['cd C:\\Users\\Tecno\\Desktop\\Cristian\\Camera C++\\Camera_Test\\bin\\Debug', 'Camera_Test.exe']
p = subprocess.Popen('cmd.exe', stdin=subprocess.PIPE,stdout=subprocess.PIPE, stderr=subprocess.PIPE)
for cmd in cmds:
p.stdin.write(cmd + "\n")
p.stdin.close()
temp = p.stdout.read()
if "FAIL" in temp:
print "Failed"
I had to do it like this ( with two commands ) otherwise it didn’t work
- The C++ program executes and returns the output on a .txt file
- From Ignition I read the .txt file
1 Like