System.util.execute, command string

I do

system.util.execute(["/usr/local/bin/ignition/data/TJ/python3 myio.py"])

but it gives an error

Blockquote
java.io.IOException: Cannot run program "/usr/local/bin/ignition/data/TJ/python3 myio.py": CreateProcess error=2, The system cannot find the file specified

The file does exist. What command string should I use to run myio.py?
Note, I am running ignition in a raspberry pi.

Are you running the client on the same computer as the gateway? Which computer has /usr/local/bin/ignition/data/TJ/python3 myio.py? Perspective will only look on the gateway computer.

It's running at the gateway.

Those should be 2 separate elements in the array, i.e.

system.util.execute(["/usr/local/bin/ignition/data/TJ/python3", "myio.py"])

I'm still getting the same error.

tried below, also same error

Blockquote
system.util.execute(["/usr/local/bin/ignition/data/TJ/ls"])

What’s the exact error?

What scope are you running this from? It looks like you have python3 installed on the Gateway, so running it from the designer script console, for example, will not work. The path to the file you’re trying to execute may also be relative to the Ignition dir, so you might need to either make it absolute or account for that.

Why would you expect this to work? Did you install the ls executable in that folder?

Is python3 installed in that folder? You need the path to the executable.

Tip: Use the </>` Preformatted Text button for code, not the " Blockquote button.

1 Like

Aah, got you! Thanks pturmel for the clue.

Change it to

system.util.execute(["python3", "/usr/local/bin/ignition/data/TJ/"myio.py"])

Thanks to Transistor for the tip.