[IronPython] calling multiple python methods
Brandon Furtwangler
furtwan1 at msu.edu
Fri Jan 6 17:59:30 CET 2006
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/e1f32501/attachment.html>
More information about the Ironpython-users
mailing list