Are there any plans to support Jython 2.5.2 in the embedded Jython interpreter console (I'm talking about the version that comes with Pydev plugins and is used when you start an interpreter within the Eclipse JVM). I need this in order to use the Django library which uses the yield keyword which was introduced in Python 2.4 I think.
I have tried replacing the copy of Jython that comes with Pydev but ran into a few issues.
1. The stderr stream does not work when you create a console in the Eclipse JVM. I don't know why but I worked around this by the following:
def __init__(self, old_stderr):
self.old_stderr = old_stderr
def write(self, string):
old_stderr = sys.stderr
sys.stderr = WritableObject(old_stderr)
For some reason the errors are not flushing to the screen so this made it work.
2. Whenever I close the embedded Jython interpreter it crashes Eclipse. I have tried to debug this but it's dying somewhere that I can't get to.
3. I get a few popup errors because Pydev depends on a Jython class that was removed (PyClass). This may be the cause of the other errors too.
So, will Jython be updated or does anybody know of a fix to these issues?
There are no plans to upgrade the internal Jython version - on the contrary, there are plans to stick with the current Jython for a long, long time… details at: http://pydev.blogspot.com/2011/12/preparing-for-pydev-230.html (it's currently an optimized version of Jython 2.2.1).
Now, I'm curious, why would you want to run Django inside of Eclipse and not as a separate process (in which case you could use any Jython version you wanted)?
Reason I want to use the embedded Jython is because we have created a number of Eclipse plugins and all of our project data resides in the plugins. It is very convenient to write some embedded jython code and have access to the plugins and project data at runtime. We can then write scripts to manipulate the data in Python which is also convenient.
I understand your position on the Jython version. However, would you be willing to make the code compatible with Jython 2.5.2 (no bugs at least) and let users upgrade themselves if desired? I don't think that many changes would be required.
Thank you. I do love Pydev, just have some specialized needs I guess.
I must say that I'm pretty short on time to do that integration… but I can help in guiding you if you'd be willing to fork PyDev in github to add those changes… (PyDev uses Jython from the sources now and not from a .jar, so, follow instructions from http://pydev.org/developers.html to get the code/build and then remove W:\pydev\plugins\org.python.pydev.jython\src_jython sources and add the Jython 2.5.2 sources on top of it… (and then, most of what's left is fixing compilation errors that may arise - probably mostly adding the jython dependencies to the classpath).
Ok, I will give it a try. I have spent a little time trying to debug the issues but I wasn't able to get to the bottom of them. Some of the exceptions seem to occur even below the level of Jython and Pydev (I think it may be in the Apache XML code) but maybe I did not have things set up correctly as you have described.
Thanks for the ideas.