Hi,
I have one question, I have such code
this._engine = Python.CreateEngine();
ScriptSource source = this._engine.CreateScriptSourceFromString(script.SourceCode);
ScriptScope scope = this._engine.CreateScope();
ObjectOperations operations = this._engine.Operations;
source.Execute(scope);
And I am trying to execute IronPython code from tutorial:
from System.Collections import BitArray
ba = BitArray(5)
ba.Set(0, True) # call the Set method
print ba[0]
So it executes correctly, but I can't understand if i have print ba[0]
why it doesn't output this value to the console? By the way, could you advice some good articles about using IronPython for applications scripting?
And another question is if I have some Python class and I do not know the name of this class, because the client can define it manually, is it possible to create an instance of this class? For example
class SomeClass(object):
def some(self, a, b):
return <something>
Now I'm trying to use this code
dynamic SomeClass = scope.GetVariable("SomeClass");
dynamic something = SomeClass();
something.some(x,y);
Should I iterate through ScriptScope.GetItems()
collection and search for PythonType
objects?