JSR223 Access Python class instances through Java

J

Jared Klumpp

I am trying to access (from Java) a python class that extends a Java
interface. The following program runs fine in the jython console (I
can instantiate Tada, call t.getName() and everything prints
correctly.) However, if I invoke test1() from Java using JSR223, the
returned object is inaccessible (proxy type) and none of the "in
init", "in getName" strings will print.

Furthermore, none of the lines print unless I convert ITest to a
concrete class, but then the getName methods return the concrete
implementation's string.

Has anyone successfully had this situation work, and how did you do
it?

Thanks in advance

Code:
===========
import ITest

class Tada(ITest):
def __init__(self):
print "In Init"

def getName(self):
print "In getName"
return "Joe Schmoe"


def test1():
t = Tada()
print t.getName()
print "Hello, World"
return t
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,235
Members
46,821
Latest member
AleidaSchi

Latest Threads

Top