IronPython.Runtime.Exceptions.ImportException: 'No module named datetime'
ShakirEE opened this issue · comments
Prerequisites
The issue tracker is used to report bugs and request new features, NOT to ask questions.
Hello there, I have pretty much followed the solutions mentioned on stack overflow and got through some of the module issues except for this one. I first installed ironpython from my .net project. Then later installed ironpython to my windows, which is my i am sending multiple search paths but no luck getting around it. If anyone can give any advice that will be very appreciated.
Thanks
Shakir
You need to call SetSearchPaths
to apply your changes:
var searchPaths = engine.GetSearchPaths();
searchPaths.Add("<your path here>"); // add your path to the stdlib here
engine.SetSearchPaths(searchPaths);
Actually, the datetime
module is built-in with IronPython 2 so I'm not sure what you could be doing wrong. This works for me:
var engine = Python.CreateEngine();
engine.Execute("import datetime; print(datetime)");
Just a note: my project used the ironpython nuget package and I had this error until I used the described SetSearchPaths method (with "c:\program files\IronPython 3.4\lib" in my case).