HI
I created a simple function to take a string (Python
code statements), compile them and execute them in the scope defined.
private void CompileSourceAndExecute(String code)
{
ScriptSource source = pyEngine.CreateScriptSourceFromString
(code, SourceCodeKind.Statements);
CompiledCode compiled = source.Compile();
// Executes in the scope of Python
compiled.Execute(pyScope);
}
refer links
http://www.codeproject.com/KB/cs/C_Sharp_and_Iron_Python.aspx#
Some links:
- http://aspnet.codeplex.com/wikipage?title=Dynamic%20Language%20Support&ProjectName=aspnet
- http://stackoverflow.com/questions/441838/ironpython-on-asp-net-mvc