possible to pass python objects into java without jython?

Maurice Ling mauriceling at acm.org
Tue Nov 9 22:29:05 CET 2004

Jeremy Jones wrote:

> Maurice Ling wrote:
>> Hi,
>> I have read that this had been asked before but there's no 
>> satisfactory replies then.
>> I have a module (pA) written in python, which originally is called by 
>> another python module (pB), and passes a python object (pO) to pB. 
>> Now I require pA to be called in a java class (jC) and pass pO into 
>> jC. As pA uses non-python modules, I am not able to use Jython on this.
>> Are there any way out in this?
>> Thanks in advance.
>> Maurice
> How about:
>     * XMLRPC
>     * SOAP
>     * a messaging queue of some sort (pA or pB - I'm a little unclear
>       on which is the starting point - could put pO in a message queue
>       and jC could pick it up)
>     * serialize the Python object to disk in an intermediate format
>       (say, XML) and have the Java process pick it up
>     * CORBA
> Without more details, and some clarification, that's the best I can 
> do.  Are you sure you meant to say pA is called by pB, or is it the 
> other way around?  If pA is being called, it really can't pass pO to 
> pB, unless you've got a callback setup.
> Jeremy Jones

Say this scenario...

pA.py contains
imports (something non-pure python)
def A(n):
    ...(does something)...
    returns pO

pB.py comtains
import pA
def B(n):
    (does something)
    x = pA.A(n)
    (does more things)

How can I get Java to call pA.A function and then receives the object it 
returns? I am considering SOAP or CORBA, but just wondering if there is 
any other ways without resorting to network or socket programming, since 
all modules are on the same machine?


-------------- next part --------------
A non-text attachment was scrubbed...
Name: mauriceling.vcf
Type: text/x-vcard
Size: 347 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20041110/cc07c42a/attachment.vcf>

More information about the Python-list mailing list