0
我有一個python腳本,我正在通過使用Jython的java進程執行相同的操作。沒有模塊名爲pymongo - Jython
數據庫 - MongoDB的
的pom.xml
<dependency>
<groupId>org.python</groupId>
<artifactId>jython-standalone</artifactId>
<version>2.7.0</version>
</dependency>
Java進程
public String execute(String val) throws FileNotFoundException,
ScriptException {
ClassLoader classLoader = getClass().getClassLoader();
InputStream is = (InputStream) classLoader
.getResourceAsStream("my.py");
PythonInterpreter interpreter = new PythonInterpreter();
interpreter.execfile(is);
PyObject someFunc = interpreter.get("myFunc");
PyObject result = someFunc.__call__(new PyString(val));
String realResult = (String) result.__tojava__(String.class);
return realResult;
}
當我運行python腳本,my.py
,我得到以下錯誤
File "<iostream>", line 3, in <module>
ImportError: No module named pymongo