|
From: Heshan S. <hes...@gm...> - 2008-04-28 09:00:47
|
Hi,
I did the following and it works fine. Thank you for all you guys for
your valuable advice and guidance.
System.out.println("testing 123");
PySystemState.initialize();
PythonInterpreter interp = new PythonInterpreter();
interp.exec("import sys");
interp.exec("print sys.path");
String str3 =
"/home/heshan/workspace/IdeaProjects/PYtest/src/essentialScripts/myfile.py";
interp.execfile(str3);
PyObject obj = interp.eval("getDictionary()");
String str4 = "dictToJavaMap(" + obj + ")";
PyObject obj2 = interp.eval(str4);
HashMap map = (HashMap) obj2.__tojava__(HashMap.class);
Iterator k = map.keySet().iterator();
while (k.hasNext()) {
String key = (String) k.next();
System.out.println("Key " + key + " === Value " +
/*(String)*/ map.get(key));
}
--
Regards,
Heshan Suriyaarachchi
|