I have an embedded scripting engine in my C# application that uses IronPython 2. I create the Python runtime and add a few classes to the global namespace so that the script
When you create the engine, you can add an "Arguments" option the contains your arguments:
IDictionary options = new Dictionary();
options["Arguments"] = new [] { "foo", "bar" };
_engine = Python.CreateEngine(options);
Now sys.argv
will contain ["foo", "bar"]
.
You can set options["Arguments"]
to anything that implements ICollection
.