Reputation: 143
I have a script in python that should receive two PDF files and output an image. It works fine in the terminal but when I try to run it in a Java process using process builder it gives me a syntax error and I am not sure why.
I am using python3 with the command (in the terminal):
python3 /pathToMyPythonScript/command_line.py /Users/myname/Desktop/one.pdf /Users/myname/Desktop/two.pdf > /Users/myname/Desktop/XXXXXXXXXXXXXXXXXXXXX.png
It works and produces the desired output.
also tried:
/usr/local/bin/python3 /pathtomypythonscript/command_line.py /Users/myname/Desktop/one.pdf /Users/myname/Desktop/two.pdf > /Users/myname/Desktop/XXXXXXXXXXXXXXXXXXXXX.png
and it also works fine.
When I call the same script in my java code using the following code:
Process p = new ProcessBuilder("/usr/local/bin/python3", fileOneLocation, fileTwoLocation, outputFileDestination).inheritIO().start();
all variables are declared and all files exist.
My eclipse console output is an error:
File "/Users/myname/Desktop/one.pdf", line 1
%PDF-1.3
^
SyntaxError: invalid syntax
What am I missing here? It works fine in terminal but not in Java.
Upvotes: 0
Views: 324
Reputation: 6153
As an answer:
You forgot to mention your actual python script in the ProcessBuilder
Upvotes: 1