From: Nathan P. <npa...@cl...> - 2010-04-28 20:50:31
|
ugh, shamefacedly I must admit that I totally missed the plot on the python side. I had neglected to make my python object a subclass of the FooType thing, i.e. I was doing: class Foo: where I should have been doing class Foo(FooType): with the necessary foregoing import of the FooType interface. now that this is wired up properly, I'm back in the realm of more understandable debugging. Nathan Parrish wrote: > just joined this list, and responding to the following message from the > archives, sorry the threading will be all messed up: > From: Ian Kallen <spidaman.list@gm...> - 2010-04-25 06:09 >> Does anybody have advice as to how to run python scripts packaged inside a >> jython 2.5.1 jar? I tried building a jar as described here >> http://wiki.python.org/jython/JythonFaq/DistributingJythonScripts#Runthescript.2BAC8-jar... >> a jar with jython, + Lib, + my own .py but that doesn't work. Are >> those docs only applicable to jython 2.2 ? If so, how are folks working with >> 2.5.1? Creating class files with clamp? >> pointers appreciated, >> -Ian >> > > > this is probably a bit blind-leading-the-blind, but I'm also beginning > to work on utilizing jython code within a java service. it sounds like > the preferred method (vs. 2.2-era jythonc approach) is the object > factory approach, described at > http://wiki.python.org/jython/JythonFaq/EmbeddingJython > > I believe that using this approach and adding your .py files to a > standalone .jython jar (built by the installer) ought to work. the > added advantage, to my mind, is that you can tweak your python code > without recompiling; this is in fact my main motivation for > incorporating jython into my project -- my python development goes about > 10X faster than java, certainly reflective of my relative prowess or > general abilities, but a fact nonetheless. > > however I am currently encountering a problem with this approach, > although I'm not yet at the point of embedding my python in the jar, but > instead explicitly pointing sys.path to where my scripts live. > > my current hurdle is that where I call the __tojava__ method and cast to > the fooType thing in the create() method, I get the exception: > java.lang.ClassCastException: org.python.core.PySingleton cannot be cast > to com.sproutsys.qa.staf.TestopiaRPCType > > this is with jython 2.5.1 on jdk 1.6.0_14 (to which I'm in no way > married). > > hope this is helpful for Ian, and I'm appreciative of any hints on how > to get over my current hump. > > thanks, > nathan > > ------------------------------------------------------------------------------ > _______________________________________________ > Jython-users mailing list > Jyt...@li... > https://lists.sourceforge.net/lists/listinfo/jython-users |