[IronPython] Calling a Python function (compiled into an assembly) from C# using delegates.
empirebuilder at gmail.com
Wed Jan 21 16:23:14 CET 2009
I think you have to import the function - loading the assembly alone is not
On Wed, Jan 21, 2009 at 5:17 PM, Renaud Durand
<renaud.durand.it at gmail.com>wrote:
> Hi again,
> I'm trying to call a python function from C#. I found out through a
> tutorial how to do it from
> a Python source file but I would like to do it from a compiled assembly.
> Some elements are missing.
> I think it is something like below but this does not work:
> eng = Python.CreateEngine()
> Assembly interpreter = Assembly.Load("interpreter");
> ScriptScope scope = eng.CreateScope();
> //Get the interpretMapping function
> Func<string, object> interpretMapping;
> interpretMapping = scope.GetVariable<Func<string,
> ObjectOperations ops = eng.Operations;
> //Get the interpItem returned by function.
> object item =
> //Get the display Method
> object method = ops.GetMember(item, "display");
> Thank you... Again :-)
> Renaud Durand
> EPITA Student
> Users mailing list
> Users at lists.ironpython.com
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Ironpython-users