Hi IronPython experts,
I am a newcomers in the IronPython, I am working on update the IronPython
engine in our c# project.
After studied some days from all of your articles, I still have one question
can't be fixed.
In IronPython v1.0, we use the below code to call a function in the .py file
this.pythonEngine = new PythonEngine();
// Load the script
this.pythonEngine.ExecuteFile(@filePath);
string address;
address = this.pythonEngine.Evaluate("GetScriptInfo").ToString();

How can I implement this in the IronPython v2.6?
I write some code in c# as below,

ScriptEngine engine = Python.CreateEngine();
ScriptScope pyScope = engine.CreateScope();
ScriptSource ss;
ss = engine.CreateScriptSourceFromFile("D:\\test.py");
ss.Execute();
ScriptSource execute the whole python file now, how can I call the specific
function(for example, the GetScriptInfo() function)?

test.py file:
def GetScriptInfo ():
sXML='<script>script info</script>'
return sXML

def GetBodyInfo ():
sXML='<script>body info</script>'
return sXML

Thanks a lot!

Best Regards,
Evan Wang
_______________________________________________
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to