Passing array from java to python

Marco Nawijn nawijn at gmail.com
Fri Jun 3 14:54:47 EDT 2011


On Jun 2, 11:54 am, loial <jldunn2... at gmail.com> wrote:
> I need to pass some sort of array or hashmap from Java and read the
> data in a python script (which will be called by the java class). Is
> there any neater way  to do this other than just passing strings?

I recently had to deal with the same problem, some bi-directional
communication between Java and Python. Several options were discussed
between me and my fellow programmer. In the end we settled for XML-
rpc. It works remarkably well in our case. We use it to pass test and
simulation data to GUI code. XML-rpc is very well supported in python.
Basic types (lists, dicts etc.) are encoded automatically. If the
arrays are very large, I would probably use an intermediate database
(e.g. Hdf5) for storage and then use some sort of messaging to inform
the Java code of any changes.




More information about the Python-list mailing list