As I know pretty much nothing about Python, I'm trying to run a python script that I need from Java. I don't need to interface with it's interfaces or anything else, just simply start it with certain arguments.
Following other overflow threads like this one, I am starting the script as follows:
String longitude = "snip"; // Will be a number like +/-xx.xxxxxxx
String latitude = "snip"; // Will be a number like +/-xx.xxxxxxx
String[] command = {"python", "example.py",
"-a", "ptc",
"-u", "snip", // Username
"-p", "snip", // Password
"-l", longitude + " " + latitude,
"-st", "10"
};
ProcessBuilder probuilder = new ProcessBuilder(command);
probuilder.directory(new File("snip")); // Simply a folder where file is
Process p = probuilder.start();
After this I just have a few lines that capture the output of the process and output it to System.out, then run Process.waitFor() so the main thread doesn't return until the python finishes. The issue is, the python script I'm running (found here) uses multiple threads, and I believe it's unable to start all threads. I get output from Flask, but then nothing happens yet Process.waitFor() does not return. Is there a way to correctly run multithreaded python scripts through java?
For reference, here is the output I'm getting, and here is expected output.