I am having a tough time getting jython to work properly when run from an Eclipse plugin. I have a simple object factory that loads a python module conforming to a Java Interface. All of this works fine in standalone mode. However, when I package this as an eclipse plugin, I get a different error based on a few variables:
Given that my java package is com.foo.
1) If I run without modifying any paths, I get: "No module named foo"
2) If I then add my java jars to the sys.path using:
PythonInterpreter interp = new PythonInterpreter(null, new PySystemState());
PySystemState sys = Py.getSystemState();
sys.path.append(new PyString("myjar..."));
I get:
a) My python module's constructor gets called (print in the constr shows up)
b) I get a PySingleton returned from the call to tojava. The name field is "Error".
3) At this point, I try to make the classpath exactly the same in Eclipse as Standalone, so I add my jars to the classpath at runtime just before the python interpreter is called.
I get my favorite error message: SystemError: Automatic proxy initialization should only occur on proxy classes
This one is driving me crazy. I was impressed with how fast I got this going in standalone mode. Should running under Eclipse be that much different? I believe it should only be a matter of the classpath, but so far, that doesn't seem to be it.