|
View:
New views
1 Messages
—
Rating Filter:
Alert me
|
|
|
Calling methods in derived classes throws exception when executing scripts via the javax.script apiHi!
When I execute the following simple script from inside java using the java.script api I get aTypeError exception (see below). #--------------------------- from java.lang import Object class MyClass(Object): def __init__(self, foo): print foo c = MyClass("Hello from Jython") #--------------------------- If I execute the same script directly from Jython everything works as expected. Is there anything wrong in what I'm doing or this this a major issue in Jython 2.5.1? Previously I was using Jython 2.1/2.2.1 inside ANT for scripting. When calling this script via the old BSF binding everything works well. But starting with Jython 2.5 it is not possible to use the BSF mechanism anymore due to the fact that the PyInstance class has been removed. With Jython 2.5.x it is necessary to use the scripting API from Java 1.6. That works well as long as I'm not deriving any Jython class from a Java class. Can anyone give me a hint to avoid this problem when using Jython 2.5 from Ant? Thanks Jochen Traceback (most recent call last): File "<stdin>", line 1, in <module> at org.python.jsr223.PyScriptEngine.scriptException(PyScriptEngine.java:182) at org.python.jsr223.PyScriptEngine.eval(PyScriptEngine.java:43) at org.python.jsr223.PyScriptEngine.eval(PyScriptEngine.java:48) at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:232) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:175) at org.python.core.PyObject.__call__(PyObject.java:355) at org.python.core.PyMethod.__call__(PyMethod.java:215) at org.python.core.PyMethod.instancemethod___call__(PyMethod.java:221) at org.python.core.PyMethod.__call__(PyMethod.java:206) at org.python.core.PyObject.__call__(PyObject.java:397) at org.python.core.PyObject.__call__(PyObject.java:401) at org.python.pycode._pyx36.f$0(<stdin>:1) at org.python.pycode._pyx36.call_function(<stdin>) at org.python.core.PyTableCode.call(PyTableCode.java:165) at org.python.core.PyCode.call(PyCode.java:18) at org.python.core.Py.runCode(Py.java:1204) at org.python.core.Py.exec(Py.java:1248) at org.python.util.PythonInterpreter.exec(PythonInterpreter.java:181) at org.python.util.InteractiveInterpreter.runcode(InteractiveInterpreter.java:89) at org.python.util.InteractiveInterpreter.runsource(InteractiveInterpreter.java:70) at org.python.util.InteractiveInterpreter.runsource(InteractiveInterpreter.java:46) at org.python.util.InteractiveConsole.push(InteractiveConsole.java:110) at org.python.util.InteractiveConsole.interact(InteractiveConsole.java:90) at org.python.util.jython.run(jython.java:316) at org.python.util.jython.main(jython.java:129) Caused by: Traceback (most recent call last): File "<script>", line 7, in <module> TypeError: org.python.proxies.__main__$MyClass$11(): expected 0 args; got 1 at org.python.core.PyException.fillInStackTrace(PyException.java:70) at java.lang.Throwable.<init>(Throwable.java:181) at java.lang.Exception.<init>(Exception.java:29) at java.lang.RuntimeException.<init>(RuntimeException.java:32) at org.python.core.PyException.<init>(PyException.java:46) at org.python.core.PyException.<init>(PyException.java:43) at org.python.core.PyException.<init>(PyException.java:61) at org.python.core.Py.TypeError(Py.java:195) at org.python.core.PyReflectedFunction.throwError(PyReflectedFunction.java:195) at org.python.core.PyReflectedFunction.throwArgCountError(PyReflectedFunction.java:248) at org.python.core.PyReflectedFunction.throwError(PyReflectedFunction.java:305) javax.script.ScriptException: javax.script.ScriptException: TypeError: org.python.proxies.__main__$MyClass$11(): expected 0 args; got 1 in <script> at line number 7 ------------------------------------------------------------------------------ Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf _______________________________________________ Jython-users mailing list Jython-users@... https://lists.sourceforge.net/lists/listinfo/jython-users |
| Free embeddable forum powered by Nabble | Forum Help |