Hi,
So I've got the PythonInterpreter running inside my Java app
(thanks to everyone for the pointers to PyServlet example) and I
successfully get a Proxied class object from this bit of code that
looks something like:
interpreter().execfile(testFile.getAbsolutePath());
PyObject cls = interpreter().get("Test");
Object o = cls.__tojava__(Class.class);
Class testClass = (Class)o;
This testClass is the class object for the Test class file read in
from this Test.py:
from com.webobjects import appserver
class Test(appserver.WOComponent):
def testName(self):
"@sig public String testName()"
return "Hello World"
So the catch is that a subclass of WOComponent must be
created with a one argument constructor, soemthing that would
normally look like Test t = new Test(aWOContext). So from the
created Class object I grab the correct constructor and then attempt
to create the object at which point I get the following exception:
code:
wocomponent = constructor.newInstance(new Object[] {
aWOContext });
Exception:
Traceback (innermost last):
(no code object) at line 0
ImportError: no module named main
Anyone know offhand? Can you create a proxied object via a
constructor off of the Class object or have I somehow bungled my
jython environment? Thanks for any help.
Regards,
Max
|