Run a java Processing sketch with Python

Hi,

I want to use a python script run a processing sketch multiple time but with different args for each run.

I have processing sketch that works well if i run it manually via a cmd line eg “processing-java.exe --sketch=“path\to\sketch” --present ”

How would I write the .py script to trigger the sketch and pass it different args per iteration.
Thx!

Note: I don’t need to convert the processing sketch to python I only want to trigger it to run with python.

Hi @BBGiraffe,

Presuming you know how to write a python script in general. So just use…

If you want it to unlink it from your main script just use
creationflags=subprocess.DETACHED_PROCESS

Cheers
— mnse

Thx: for more detail on how I resolved this:

command = f'processing-java.exe --sketch=E:\\path\\to\\processing\\folder --run'

def run_command(command):
    #run the command
    process = subprocess.Popen(command, shell=True, stderr=subprocess.PIPE)
    #capture the output
    output, error = process.communicate()
    #return the output
    return output