I am trying to have a project script run a .exe on the gateway and then return the results to the client project script. If running the .exe in a similar manner on the client, it works just fine. Here I need the .exe to run on the gateway. The .exe is on the gateway C drive with GatewayLocalDir pointing to it.
Here is the Gateway Message Handler:
def handleMessage(payload):
import subprocess
try:
path = payload["path"]
process = subprocess.Popen([path], stdout=subprocess.PIPE)
output, _ = process.communicate(timeout=10)
return output
except Exception as e:
return str(e)
Here is a snippet of the project’s script:
try:
import base64
from java.io import ByteArrayInputStream
from javax.imageio import ImageIO
payload = {"path": GatewayLocalDir}
result = system.util.sendRequest("Gateway", "runLabelGenHandler", payload)
image_bytes = base64.b64decode(result)
input_stream = ByteArrayInputStream(image_bytes)
return ImageIO.read(input_stream)
In the end, it’s not returning an image and failing the try. Please help