Reputation: 161
I got server which is starting process with python script and when it is running I got error:
Traceback (most recent call last):
File "save_boxes.py", line 2, in <module>
import cv2
ImportError: No module named cv2
In fact I got opencv2 installed and script is working when I run it from terminal, have no ideas how to fix it, appreciate any advices, thank you!
The code Im running the script is:
Process process;
try {
final char dm = (char) 34;
ProcessBuilder pb = new ProcessBuilder("./runC.sh", "myArg1", "myArg2");
Map<String, String> env = pb.environment();
env.put("VAR1", "myValue");
env.remove("OTHERVAR");
env.put("VAR2", env.get("VAR1") + "suffix");
pb.directory(new File("/home/user/IdeaProjects/MyServer/"));
process = pb.start();
int exitCode = process.waitFor();
if (exitCode != 0) {
throw new IOException("Command exited with " + exitCode);
}
} catch (Exception e) {System.out.println ("error message: " + e.getLocalizedMessage());}
The script code:
#!/bin/bash
python my_script.py
Upvotes: 0
Views: 460
Reputation: 622
Try to use python3
. On most of the systems, python
is a link to the Python 2 interpreter. :)
Upvotes: 2