2
進出口使用IronPython的創建System.Windows.Media.Color和我嘗試實例從腳本的顏色,並將其返回。 我得到了這個方法,在此字符串作爲參數發送IronPython中
@"
from System.Windows.Media import Color
c = Color()
c.A = 100
c.B = 200
c.R = 100
c.G = 150
c
");
_python = Python.CreateEngine();
public dynamic ExectureStatements(string expression)
{
ScriptScope scope = _python.CreateScope();
ScriptSource source = _python.CreateScriptSourceFromString(expression);
return source.Execute(scope);
}
當我運行這段代碼,我得到
$異常{System.InvalidOperationException:序列不包含任何匹配的元素 在System.Linq的.Enumerable.First [TSource(IEnumerable`1源,Func`2謂語)......等
我無法弄清楚如何得到這個工作,所以請幫助我。
因爲我沒有看到你的源第一個呼叫,你能提供整個堆棧,並在項目中的任何其他來源? –
例外,不幸的是,沒有指向實際的問題 - 這是在託管IronPython的一個錯誤:http://ironpython.codeplex.com/workitem/32679。實際的異常會丟失。 –
Simon900225,你將能夠提供一個最小的項目,使你得到了錯誤?我無法複製它。 –