Python <-> Jython communication

Derek Thomson derek at wedgetail.com
Sat May 11 04:21:48 EDT 2002


Hi,

Etienne Labuschagne wrote:
> I am still looking for a nice and easy solution for communicating 
> between Python and Jython.
> 
> Here are my experiences so far:
> 
> XML-RPC : can't get it to work from the Jython side, having problems 
> with especially sending pickled objects (the pickled string 
> specifically) as params

This will be difficult, as the XML-RPC modules aren't (officially) 
supported by Jython.

> 
> Soap            : haven't tried it, afraid of same problems as above

I don't know if there are Jython-ported SOAP modules, so, yes, the above 
applies. <flame> SOAP's broken-by-design anyway. No object references! 
</flame>

> Sockets         : should work - lots of work to implement

Yes, all of the above, and CORBA, are trying to save you from the pain 
of marshalling, among other things.

> Corba           : sounds good, but have NO experience in it, lots of work

Since I went to some trouble to make sure Fnorb 
(http://sourceforge.net/projects/fnorb), works on Jython (*) , I'm going 
to say this is the answer. It's not actually that difficult. You specify 
your interface in an interface definition language (IDL), then implement 
a server that supports the defined operation calls. Take a look in 
examples/hello-world in the Python CVS tree, and I think you'll see that 
it's not hard. Python makes it a *lot* easier than CORBA C++ examples 
would make you think it will be.

Anyway have a look at it, and feel free to email me privately if you 
need some guidance.

(*) There's Jython support in the only CVS trunk, so you have to do a 
CVS checkout. There are instructions on the site.

> Pyro            : seems like the solution, but does it work in Jython?

I just took a brief look at this. It seems to be no simpler than Fnorb, 
and has the problem of being non-standard i.e. you can't at some later 
time decide to implement some objects in Java/C++/C/Perl or make calls 
on objects implemented in those languages.

> 
> Any other suggestions/comments.
> 
> Assume that I have code that cannot run in Jython and that is why I must 
> still stick to Python in some areas. 

Fnorb supports Jython. That's one of the main reasons I removed the 
little bit of C code that Fnorb had, so it would run cleanly on Jython. 
This feature is not going away.

> Assume that I have code that uses 
> Java libs and that is why I must stick to Jython in the other areas.  
> Assume that the code runs on the same machine 

This will work fine.

Regards,
Derek.





More information about the Python-list mailing list