0

To put this simply, I have a java application that generates a certain .txt file, and a python script that uses this text file to generate a graph using Plotly. When I run the script on its own, it works just fine. The java application also correctly generates the text file, then the python script is called.

I have tried two ways to call the script: Process p = Runtime.getRuntime().exec(../python_scripts/); and

ProcessBuilder pb = new ProcessBuilder("python"," ../python_scripts/ScatterPlot.py");
pb.start();

It works just fine from terminal, just not when called from my java program. The file is obviously found since no exception is thrown.

user2774695
  • 116
  • 7
  • Try replacing "python" with the full path to your local python. – Eric Nov 01 '16 at 02:54
  • What if you inherit output and error to current stdout and stderr following http://stackoverflow.com/questions/14165517/processbuilder-forwarding-stdout-and-stderr-of-started-processes-without-blocki ? Do you see any errors? – rsutormin Nov 01 '16 at 03:06
  • And can you make sure that new File("../python_scripts/ScatterPlot.py").exists() returns true ? – rsutormin Nov 01 '16 at 03:07
  • And it looks like you have leading space in " ../python_scripts/ScatterPlot.py" path. – rsutormin Nov 01 '16 at 03:08

0 Answers0