IronPython ImportException: No module named logging

前端 未结 1 1854
情深已故
情深已故 2021-01-06 02:36

I got ironpython working fine on mono, but it doesn\'t import the logging module. Executing this code:

ScriptEngine engine = Python.CreateEngine         


        
相关标签:
1条回答
  • 2021-01-06 03:06

    It's not enough to add the assemblies to your C# application. logging is written in python, and it's part of the standard library. You'll have to add the standard library to IRONPYTHONPATH as well. You can do it like this:

    var engine = Python.CreateEngine();
    var paths = engine.GetSearchPaths();
    paths.Add(@"C:\Path\to\your\standard\library");
    engine.SetSearchPaths(paths);
    

    If you need the standard library you would probably need to ship it with your application. My suggestion is to zip it and then add the zip file to the paths.

    0 讨论(0)
提交回复
热议问题