I am trying to run a python script with runtime.exec within a custom panel.
var runtime = java.lang.Runtime.getRuntime();
var args = [“python”, “myscript.py”];
var process = runtime.exec(args);
How can I then send something to stdin?
I tried process.getOutputStream().write(‘text’) but it didn’t work.
Hi Joseph
You are on the right track but the OutputStream you get from the Process object does not have a write method that takes a String as an argument.
You should be able to take the OutputStream and use it with a MessageBuilder to handle the conversion from String to byte array.
var output = ogscript.createMessageBuilder();
output.setOutputStream(process.getOutputStream());
output.writeString(‘text’);
Cheers
James