IronPython in C#: No module named xmlrpclib
-
26-09-2019 - |
문제
I am trying to build a web application with an interactive console for IronPython. When I try to import xmlrpclib in IronPython's normal console, it works. However, if I use IronPython inside my C# code, it throws an exception "No module named xmlrpclib". Is this a known issue? Any solutions to solve this issue?
Here's the code:
var testCode = @"
import xmlrpclib;
APIServer = xmlrpclib.ServerProxy('address', allow_none=True);
print APIServer.Hello();
";
MyStream str = new MyStream();
ScriptEngine engine = Python.CreateEngine();
engine.Runtime.IO.SetOutput(str, System.Text.Encoding.ASCII);
engine.Runtime.IO.SetErrorOutput(str, System.Text.Encoding.ASCII);
ScriptScope scope = engine.CreateScope();
ScriptSource src = engine.CreateScriptSourceFromString(testCode);
src.Execute(scope);
해결책
Sorry for the silly question, it turned out that the path used by IronPython inside my C# code was not correct. I just corrected the path, and everything works fine. Thanks to digEmAll.
제휴하지 않습니다 StackOverflow