powered by Jive Software

Python transports on Jython

Anybody have any ideas on whether Jython can host the AIM, MSN, ICQ python transports?



I looked into this a couple of months ago. It seemed sort of possible but looked like it would be a PITA. This is mostly because I couldn’'t find good documentation about how well supported Twisted is supported for Jython. I half-remember finding some info about how big chunks of Twisted are supported, but it sounded like sort of a hack in some cases.


Do you have the document? What I gathered is that you need to copy pieces of CJython over to the root Python directory (ack…I’'m going to get flamed by the Python experts if they every find this).

I would like to create a bundle that supports AIM, ICQ, MSN and Yahoo!. I’'d like to be as easy to start as messenger and run anywhere (hence jython as the python impl).

That way, messenger can easily be the platform for EIM without cutting people off from their existing contacts.


I would sure like it if that was done!

newyork4me…do you know python?


Unfortunately, I don’'t remember where I read about Twisted on Jython – it was quite some time ago.


If my life depended on it, I could probably do OK with it, but otherwise…not really.

Original Twisted does not work on Jython, but there is a Java implementation (http://java.twistedmatrix.com/ I think) which should work with jython.


I managed to google some old docs on twistedmatrix.com and sourceforge/jython-users, everything looked like it was planned or in the works but i wasn’'t able to find anything diffinitive.

I’‘m no python or Java programmer, but I’‘ve worked with the py-gateways and messenger for almost a year now, so I’'d love to help you out with anything I can.

The thought of having the legacy gateways as plugins for messenger would be very cool.

Let me know if i can help.


Can you explain what this is doing in the python code. It seems to be the first place that Jython chokes.

import sys

reload(sys) # <—[/code]


Well, you can try to replace that code with this one:

import sys

del sys.modules[“sys”]

import sys


Thanks Zenith,

I just commented it out. Reading the java docs, it says that reload isn’‘t possible in Jython due to the fact that you cannot reload the class definition without replacing the entire classloader. Such is the java way. I was reading that there is some kind of reload mechanism, but I wasn’'t sure how to invoke it.

That being said, I started the conversion of pyMST-t and found the following:

True and False are not part of Jython, everyplace they’'re used, I need to define True as 1 and False 0. If anyone knows how to set this globally, please let me know.

The Twisted libraries are large and use features, like “file” that are not available in Jython. Translation to their Java counterpart is required. Also, Twisted is dependant on PyOpenSSL and PyCrypto so these will need to be converted to their java equivalents.

I do have to say, that I like Jython more and will consider diving deeper into it.