From: Abel Daniel <abli@fr...> - 2007-03-28 20:09:34
I managed to get a bit-modified-ipython-0.6.15 running under
jython. As there appears to be some interest in using ipython from
jython, here are my experiences:
First I worked around the problems noted in:
To do that, I worked around the pydoc.py bug (one-line fix in
pydoc.py); hacked IPython's Struct.py to force key to str. (This is a
bit ugly, but apparently it works.) I also had to modify inspect.py. I
included a hacked version of the one included with python2.4, where I
had to remove some stuff due to dis module missing from jython.
I also had to workaround the lack of the following:
- signal module
- sys.executable (as noted in link; note that ultraTB.py also uses it.)
- dis module
- the fact that __dict__ is a stringmap, not a dict
- missing exit, quit strings from __builtins__ and having a different
type of copyright and credits objects
All in all, I needed two core modules which were previously missing or
lacking too many things (inspect.py and pydoc.py), and had to work
around some missing stuff. I didn't have to modify jython (prefering
to workaround missing stuff), thats why I'm posting this to
jython-users (instead of jython-dev)
I uploaded the tarball of this modified 0.6.15 to
Note that jython is not included in that tarball. (I used v2.2b1)
Also note that I didn't test it that much, readline is still
missing. At first startup, it might crash because ~/_ipython is
missing. Simply cp-ing ~/.ipython (from a "ipython under CPython" run)
worked for me.
I would be interested in any comments, but can't claim to make fixes :)
ps. I noticed later that jythonconsole has a dis.py. Does that work on
jython's bytecode? I thought that would need considerable hacking as
jython compiles to java bytecode, not CPython's bytecode, and that
dis.py looks like a CPython one.
From: Don Coleman <dcoleman@ch...> - 2007-03-30 14:31:13
On 3/27/07, Abel Daniel <abli@...> wrote:
> ps. I noticed later that jythonconsole has a dis.py. Does that work on
> jython's bytecode? I thought that would need considerable hacking as
> jython compiles to java bytecode, not CPython's bytecode, and that
> dis.py looks like a CPython one.
dis.py and inspect.py in jythonconsole are from CPython 2.2
I looked at that code again. It turns out that I'm not using dis.
dis is imported by inspect, but any code that calls dis was removed.
dis does not work with jython code.