Exemplo n.º 1
0
 /// <summary>
 /// 创建实例
 /// </summary>
 /// <param name="moduleName">脚本文件</param>
 /// <example>nu</example>
 /// <returns></returns>
 public static PythonContext CreateInstance(string moduleName)
 {
     try
     {
         dynamic scope;
         if (PythonScriptHost.GetScriptScope(moduleName, out scope))
         {
             return(new PythonContext(scope));
         }
     }
     catch (Exception ex)
     {
         TraceLog.WriteError("Create instance of PythonContext error:{0}\r\n{1}", moduleName, ex);
     }
     return(null);
 }
Exemplo n.º 2
0
 /// <summary>
 /// 创建实例
 /// </summary>
 /// <returns></returns>
 public static PythonContext CreateInstance()
 {
     return(new PythonContext(PythonScriptHost.CreateScope()));
 }