Message12730
Please ignore the previous sample. Take the following one for reference:
try {
Properties properties = new Properties();
properties.setProperty("python.home", "../jython2.7.1/");
properties.setProperty("python.path", "../jython2.7.1/Lib");
properties.setProperty("python.import.site", "false");
PythonInterpreter.initialize(System.getProperties(), properties, new String[] {""});
PythonInterpreter python = new PythonInterpreter();
String script = "import sys\n" + "sys.path.append(\"../jython2.7.1/Lib\")\n" + "\n" + "import redis\n"
+ "r = redis.Redis(host='localhost', port=6379)\n" + "r.get('foo')";
python.set("script", new PyString(script));
python.exec(script);
python.close();
} catch (Exception e) {
e.printStackTrace();
}
} |
|
Date |
User |
Action |
Args |
2019-10-30 07:44:21 | rkanumola | set | messageid: <1572421461.73.0.99641486916.issue2818@roundup.psfhosted.org> |
2019-10-30 07:44:21 | rkanumola | set | recipients:
+ rkanumola |
2019-10-30 07:44:21 | rkanumola | link | issue2818 messages |
2019-10-30 07:44:21 | rkanumola | create | |
|