I'm running a python script in a java class like this:
PythonInterpreter interp = new PythonInterpreter();
PythonInterpreter.initialize(System.getProperties(), System.getProperties(), new String[0]);
interp.execfile("C:\\Users\\user1\\workspace\\Projectx\\script.py");
The problem is that script.py usually takes commandline arguments like this:
python script.py -i C:/diretory/path -o C:/directory/path
Is it possible to pass those arguments via the PythonIntepereter in Java ?
Update:
Thx to Juned Ahsan my code now looks like this:
String[] args = {"-i " + lawlinkerIfolder.toString() + " -o " + lawlinkerOfolder.toString()};
PythonInterpreter interp = new PythonInterpreter();
PythonInterpreter.initialize(System.getProperties(), System.getProperties(), args);
interp.execfile("C:\\Users\\user1\\workspace\\Projectx\\script.py");
But the script is still not getting any arguments.
Am I using this correctly ?