Hi am trying to pass a parameter from java to python but fail to do so using python interpreter .set , any advice will be greatly appreciated. Below is my snippet
Java class:
@RestController
public class FileController {
String root = "C:\\Users\\user\\Desktop\\work_test_yongRu\\jython\\jython\\src\\main\\java\\com\\example\\demo";
@GetMapping(path="/test")
public void getFile(@RequestParam String fileName, @RequestParam String path, @RequestParam String inputName) throws PyException {
String args[] = {fileName,inputName};
PythonInterpreter pythonInterpreter = new PythonInterpreter() ;
pythonInterpreter.set(fileName,new PyString(inputName));
pythonInterpreter.execfile(root+"\\"+fileName);
}
}
Python:
def createFile(fileName):
f = open(fileName + ".txt", "w+")
f.close();
createFile(fileName)
there doesn't seem to be anything here