Many solutions for using ResourceMetaPathImporter look like the following:
ScriptRuntimeSetup setup = Python.CreateRuntimeSetup(options);
var pyRuntime = new ScriptRuntime(setup);
var engineInstance = Python.GetEngine(pyRuntime);
var engine = Python.CreateEngine();
var sysScope = engine.GetSysModule();
List metaPath = sysScope.GetVariable("meta_path");
var importer = new ResourceMetaPathImporter(typeof(EmbeddedPythonEngine).Assembly, "python_27_lib.zip");
metaPath.Add(importer);
sysScope.SetVariable("meta_path", metaPath);
var source = "import csv";
var script = engineInstance.CreateScriptSourceFromString(source, SourceCodeKind.Statements);
script.Execute();
In particular, this code mimicks this answer: IronPython dependencies for scripts stored as strings. However I am using IronPython 2.7.5 and the above snippet always complains that there is no csv module.
Can anyone let me know the problem? Is 2.7.5 broken somehow? I feel like I missed something obvious.