Skip to content

Instantly share code, notes, and snippets.

@ch-hristov
Created December 4, 2015 11:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ch-hristov/770558a47b26aebff7a9 to your computer and use it in GitHub Desktop.
Save ch-hristov/770558a47b26aebff7a9 to your computer and use it in GitHub Desktop.
IronPython example
var engine = Python.CreateEngine();
var scope = engine.CreateScope();
scope.SetVariable("mol", new SmilesParser());
string script = "import clr\nk = mol.ParseMolecule(\"CCCCCC\")\nr = k.Count";
ScriptSource ss = engine.CreateScriptSourceFromString(script);
ss.Execute(scope);
var variable = scope.GetVariable("r");
MessageBox.Show(variable.ToString());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment