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: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Brandon Furtwangler
Sent: Friday, January 06, 2006 9:00 AM
To: [email protected]
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

_______________________________________________
users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to