Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/337.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 在IronPython脚本引擎中导入Pyro_C#_Ironpython_Pyro - Fatal编程技术网

C# 在IronPython脚本引擎中导入Pyro

C# 在IronPython脚本引擎中导入Pyro,c#,ironpython,pyro,C#,Ironpython,Pyro,因此,在将IronPython用作C#脚本引擎时,我在导入Pyro或Pyro4时遇到了一些问题 如果直接在ipy解释器中运行,导入工作正常,但是当ipy从c#脚本初始化为脚本引擎时,我收到以下错误 我已经在初始化时将-X:FullFrames和-X:Frames参数传递给了ipy,所以我相信我已经排除了这种可能性。事实上,无论我是否使用此参数初始化,都会发生此错误 这是我的c语言代码: 使用IPY时,这个错误通常是迟钝的,我被难住了。 任何洞察,包括任何能够获得更多回溯的技术,都将大有裨益 提前

因此,在将IronPython用作C#脚本引擎时,我在导入Pyro或Pyro4时遇到了一些问题

如果直接在ipy解释器中运行,导入工作正常,但是当ipy从c#脚本初始化为脚本引擎时,我收到以下错误

我已经在初始化时将-X:FullFrames和-X:Frames参数传递给了ipy,所以我相信我已经排除了这种可能性。事实上,无论我是否使用此参数初始化,都会发生此错误

这是我的c语言代码:

使用IPY时,这个错误通常是迟钝的,我被难住了。 任何洞察,包括任何能够获得更多回溯的技术,都将大有裨益


提前谢谢

问题是我使用了IPY 2.7.4中的DLL和2.7.7中的站点库模块

更进一步,我发现2.7.4与Pyro存在如下所述的问题:


如果您可以看到IPY的完整回溯,您可以看到Pyro中导致问题的那一行,一个黑客修复程序是注释掉该方法。

我有一个线索,在IronPython中,字符串是unicode,这可能是问题的根源。但是这仍然不能解释为什么这段代码将在标准的ipy.exe中运行,而不是在脚本引擎中运行?您是否也在运行其他python代码?如果您仅使用C#环境中的Pyro客户端功能,还可以选择使用Pyrite本机.NET库()
TypeErrorException: sequence item 0: expected bytes or byte array, str found
IronPython.Runtime.Operations.ByteOps.AppendJoin (System.Object value, Int32  index, System.Collections.Generic.List`1 byteList)
IronPython.Runtime.Bytes.join (System.Object sequence)
Microsoft.Scripting.Interpreter.FuncCallInstruction`3[IronPython.Runtime.Bytes,System.Object,IronPython.Runtime.Bytes].Run (Microsoft.Scripting.Interpreter.InterpretedFrame frame)
Microsoft.Scripting.Interpreter.Interpreter.Run    (Microsoft.Scripting.Interpreter.InterpretedFrame frame)
// Set the fullframes parameter in a dict
var options = new Dictionary<string, object>();
options["Frames"] = true;
options["FullFrames"] = true;
// create the engine  
var ScriptEngine = IronPython.Hosting.Python.CreateEngine(options);
// and the scope (ie, the python namespace)  
var ScriptScope = ScriptEngine.CreateScope();

//set the python file to execute
string scriptPath = "Assets\\test.py";
var ScriptSource = ScriptEngine.CreateScriptSourceFromFile(scriptPath);
import Pyro