Capture python script output from groovy

Hi,

We are trying to run below groovy script from camunda but not able to capture the output of the python script.

my.groovy

def sout = new StringBuffer();
def serr = new StringBuffer();
def arg1 = "arg";
def sdir = new File("my/dir/path");
def task = "python get_text.py ${arg1}".execute(null, sdir);
// also tried     def task = "python ${sdir}/get_text.py ${arg1}".execute();
task.consumeProcessOutput(sout, serr);
task.waitForProcessOutput();
def actualOut= sout.toString();
if (actualOut.startsWith('Exception')) {
    // do something
}
else {
    println "${script_to_eval}";
}

get_text.py

# connect to gitlab and get content of a file in a particular repo
import gitlab
#perform operations
print(filecontent)

When i run the groovy script manually, i’m able to retrieve the output from python script and print the output to console, but when i try to run the same groovy script from camunda, it does not return anything, need some advice on how to proceed.

Note:
i have verified that the camunda is picking the correct python file by providing the complete path to the python script and also i have added python executable path to system env variables

camunda version - "7.13.0"
Server version number: 9.0.33.0
OS Name:               Windows Server 2019
OS Version:            10.0
Architecture:          amd64
Java Home:             C:\Program Files\Java\jdk-15
JVM Version:           15+36-1562

Hi s55,

this sounds very compicated since Camunda already includes Jython as a scripting-language.

Also have you checked out this Thread. Take care with the Links to the documentation, some might link to an older Version of Camunda.

Best regards,
Clemens