[IronPython] calling multiple python methods
Martin Maly
Martin.Maly at microsoft.com
Fri Jan 6 18:53:25 CET 2006
This is a bug in IronPython. A workaround you can use before we release the fix is following:
In the Options.cs (Src\IronPython\Compiler\Options.cs), change the GenerateDynamicMethods to false:
public static bool GenerateDynamicMethods = false;
Hope this helps for now and we'll have fix for this soon.
Martin
________________________________
From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Brandon Furtwangler
Sent: Friday, January 06, 2006 9:00 AM
To: users at lists.ironpython.com
Subject: [IronPython] calling multiple python methods
I am hosting iron python I my C# app and I'm running into problems calling python methods. For example given the following script:
(in MethodTest.py)
def Method1():
return 5
def Method2():
return 10
and the following C# code:
PythonEngine pe = new PythonEngine();
pe.ExecuteFile("MethodTest.py");
Console.WriteLine(pe.Evaluate("1+1"));
Console.WriteLine(pe.Evaluate("Method1()"));
Console.WriteLine(pe.Evaluate("Method2()"));
I would expect the following output:
2
5
10
But I actually get:
2
5
5
I fould out that when I call "Method2()" it actually just calls the first method in the py file...so changing MethodTest.py to:
def Method2():
return 10
def Method1():
return 5
then I get the output of:
2
10
10
This is basically a show stopper for me because I need the user to be able to define more than one function which I call from C#.
Any suggestions?
-Brandon Furtwangler
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20060106/406a9e98/attachment.html>
More information about the Ironpython-users
mailing list