I’m using the implementation of ironpython 2.6.2 in my application c# 3.5, but I’m getting the following error: “The method or operation is not implemented.”
Added references to the DLR and IronPython assemblies (all found in the IronPython install directory, which is “C:\Program Files\IronPython 2.6” on my machine):
IronPython.dll
IronPython.Modules.dll
Microsoft.Scripting.dll
Microsoft.Scripting.Core.dll
follows the code of my application:
ScriptEngine engine = Python.CreateEngine();
//parameter file path
ScriptSource source = engine.CreateScriptSourceFromFile(pathFilePy);
ScriptScope scope = engine.CreateScope();
ObjectOperations op = engine.Operations;
source.Execute(scope); // class object
object classObject = scope.GetVariable("calc"); // get class object
object instance = op.Invoke(classObject); // create instance
object method = op.GetMember(instance, "calc01"); // get method
var result = op.Invoke(method, 10, 20,30); // call method and get result
the code file .py
class calc(object):
def calc01(self,var1,var2,var3):
bla = ((var1+var2+var3)/3)
return bla
The error occurs on this line:
var result = op.Invoke(method, 10, 20,30); // call method and get result
Maybe you should call it with 4 arguments instead of 3 like this: