Пример #1
0
        /// <summary>
        /// 执行Python脚本文件
        /// </summary>
        /// <param name="fileName"></param>
        /// <param name="processParams"></param>
        /// <returns></returns>
        public static object ExecutePythonFile(string fileName, Dictionary <string, object> processParams)
        {
            PythonRuntime runtime = GetRuntime();

            try
            {
                return(runtime.ExecutePythonFile(fileName, processParams));
            }
            finally
            {
                s_pythonRuntimes.AddObjectToPool(runtime);
            }
        }
Пример #2
0
        /// <summary>
        /// 执行Python表达式。带返回值
        /// </summary>
        /// <param name="expression"></param>
        /// <param name="processParams"></param>
        /// <returns></returns>
        public static object ExecutePythonExpression(string expression, Dictionary <string, object> processParams)
        {
            PythonRuntime runtime = GetRuntime();

            try
            {
                return(runtime.ExecutePythonExpression(expression, processParams));
            }
            finally
            {
                s_pythonRuntimes.AddObjectToPool(runtime);
            }
        }