Exemplo n.º 1
0
        public PythonObject(Stream pythonSourceCodeStream, PythonEntityType entityType)
        {
            _entityType = entityType;
            byte[] codeBytes = new byte[pythonSourceCodeStream.Length];
            pythonSourceCodeStream.Read(codeBytes, 0, codeBytes.Length);
            _sourceCode = Encoding.UTF8.GetString(codeBytes);

            _scriptEngine = Python.CreateEngine();

            FromSourceCode(_sourceCode);

            pythonSourceCodeStream.Close();
        }
Exemplo n.º 2
0
 public PythonObject(string sourceCode, PythonEntityType entityType)
 {
     _entityType   = entityType;
     _scriptEngine = Python.CreateEngine();
     FromSourceCode(sourceCode);
 }