Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var engine = Python.CreateEngine();
- engine.Execute("from System import *");
- engine.Runtime.Globals.SetVariable("property_value", "TB Test");
- engine.Runtime.Globals.SetVariable("result", true);
- var sourceScope = engine.CreateScriptSourceFromString("result = property_value != None and len(property_value) >= 3");
- sourceScope.Execute();
- bool result = engine.Runtime.Globals.GetVariable("result");
- engine.Runtime.Shutdown();
- global name 'property_value' is not defined
- sourceScope.Engine.Runtime.Globals.ContainsVariable("property_value")
- var engine = Python.CreateEngine();
- var scope = engine.CreateScope();
- scope.SetVariable("foo", 42);
- engine.Execute("print foo; bar=foo+11", scope);
- Console.WriteLine(scope.GetVariable("bar"));
- var engine = Python.CreateEngine();
- engine.GetBuiltinModule().SetVariable("foo", 42);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement