Hello Robin
I've encountered this problem when I use groovy to call a python script, then use the return value of python script.
The problem is that the groovy script (cmd.execute().text) always gets nothing (null).
In my python script (execute_cmd.py), I've tried print() or return() the value I want, the groovy script still gets nothing.
This is my groovy script in a Batch/shell build step:
${groovy:
def cmd = "python.exe " + configuration.getWorkspaceDir().getAbsolutePath() + "\\execute_cmd.py " + params.get("component");
logger.info("This is the cmd: " + cmd);
def result = cmd.execute().text;
logger.info("This is result: " + result)
return result
}
And if I go into the QB workspace and call a groovy script in the same directory, to call the python script, it will get the print() result from python.
The groovy script only has this hard coded statement:
def cmd = "python.exe execute_cmd.py My_component";
def result = cmd.execute().text
println result;
// result will be the return (print) value from execute_cmd.py
Can you tell me how this is?
Thank you!