I am trying to execute a python script from a spring boot project. I tried the following and seems like it is not working even though I am not getting any error. Could some one guide on a way to do the task? here is what i tried.
Note that code works well when executed as a simple java project while having the python script in the same directory. However, once I want to integrate the code as a process in a camunda schema it is not working.
The python is a simple code that creates a .txt file.
I have tried another approach that is supposed to work. I replaced the system task with a script task and tried to use groovy code. I am getting an error which is: Can’t find scripting engine for ‘groovy’: scriptEngine is null. I tried to add the groovy dependencies but now I am getting: Dependency ‘org.codehaus.groovy:groovy-all:2.4.5’ not found.
Could anyone help? note that it is a springboot project
Here’s the task:
def pmdCommand = “python C:/Users/abdallah.daaboul/Documents/PredictionsPythonCode/PythonScript.py”
def sout = new StringBuffer()
def serr = new StringBuffer()
def process = pmdCommand.execute()
process.consumeProcessOutput(sout, serr)
process.waitForProcessOutput()
System.out << sout.toString()
Hi @Daaboul
Generally speaking the easiest and most maintainable way to run python with Camunda is to use an external task client. Then you don’t need to go near any dependencies or deal with trying to add python to the engine itself.