From: Ype K. <yk...@xs...> - 2001-01-19 19:38:10
|
Jack, you wrote: (snip) >I'm between jobs at the moment and to keep my brain busy, I've >prototyped 'cyphon', a jython module that allows you to call *native* >python modules. To give you a use case: > > Jython 2.0alpha2 on java1.2 (JIT: NONE) > Type "copyright", "credits" or "license" for more information. > >>> import cyphon > >>> string = cyphon.string > >>> print string.find('abcde','d') > 3 > >or more usefully: > > Jython 2.0alpha2 on java1.2 (JIT: NONE) > Type "copyright", "credits" or "license" for more information. > >>> import cyphon > >>> cyphon.os.getenv('PATH') > 'DEBUG;C:\\JYTHON' > >cyphon achieves this by using JNI to embed python in jython: > import cyphon # dynamically loads python.dll > string = cyphon.string # calls PyImport_ImportModule("string") Sounds like you have doing the opposite of the java for python jpe project. python.dll: would this port to Unix? That is: is most of it written in python? Did you perform reflection on the types to get from jython to C? > >Now, cyphon would be really useful for using python extension modules >like MetaKit or wxPython (to name a couple of extensions that I have an >interest in). The complications I forsee are: > - inheriting from native python classes > - passing callback jython functions to native python functions >but I'm sure that these can be resolved. Some of this has probably been solved (or is being solved) in jpe. I have not seen the source for jpe yet. Thinking of it, cyphon might make an interesting alternative to jpe. >Anyway, having proved to myself that I can get this far, I've lost >motivation to complete it. If there's a demand for cyphon, I may polish >it up a bit or if anyone can tell me the most convenient way to publish >it, let me know. (it's only a few source files) I'm certainly interested in using it under Unix, but that will take work. Would anyone have an idea how much? You might ask Finn Buck to distribute the source as an experimental Jython module. Regards, Ype |