mardi 4 mars 2014

how to execute ironpython script file from silverlight 5?


Vote count:

0




I m trying to execute ironpython script file in silverlight but i m getting exceptioenter code heren Sequence contains no matching element`string importScript = "import sys" + Environment.NewLine + "sys.path.append( r\"{0}\" )" + Environment.NewLine + "from {1} import *";



// python script to load
string fullPath = @"c:\path\myModule.py";

var engine = Python.CreateEngine();
ScriptScope scope = engine.CreateScope();

// import the module

string scriptStr = string.Format(importScript,Path.GetDirectoryName(fullPath),Path.GetFileNameWithoutExtension(fullPath));
var importSrc = engine.CreateScriptSourceFromString(scriptStr, Microsoft.Scripting.SourceCodeKind.File);
importSrc.Execute(scope);

// now you ca execute one-line expressions on the scope e.g.
string expr = "functionOfMyModule()";
var result = engine.Execute(expr, scope);`


asked 50 secs ago






Aucun commentaire:

Enregistrer un commentaire