在IronPython 2.7.3中“无法导入名称Popen”

时间:2013-09-03 21:43:32

标签: ironpython

我有一个奇怪的问题,即使我在一些IronPython代码的顶部做了一个“clr.AddReference('IronPython.Stdlib')”(我确实有一个StdLib的内置副本很容易找到),我我无法访问Popen。这是一个多线程应用程序,其中许多线程(现在十个)正在尝试同时访问此脚本。

我在控制台从IronPython访问它时没有问题。

2013-09-03 17:10:11.5197 Error PythonScriptEngineProviderLib.PythonScriptEngineProvider.ExecuteCompiledCodeInternal Could not execute Python code. IronPython.Runtime.Exceptions.ImportException: Cannot import name Popen
   at IronPython.Runtime.Importer.ImportFrom(CodeContext context, Object from, String name)
   at Microsoft.Scripting.Interpreter.FuncCallInstruction`4.Run(InterpretedFrame frame)
   at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
   at Microsoft.Scripting.Interpreter.LightLambda.Run2[T0,T1,TRet](T0 arg0, T1 arg1)
   at IronPython.Compiler.PythonScriptCode.RunWorker(CodeContext ctx)
   at IronPython.Compiler.RuntimeScriptCode.InvokeTarget(Scope scope)
   at PythonScriptEngineProviderLib.PythonScriptEngineProvider.ExecuteCompiledCodeInternal(CompiledCode cc, IDictionary`2 scopeVariables) in 
...

1 个答案:

答案 0 :(得分:0)

虽然我没有这方面的解决方案(我是OP),但它似乎只是在流程启动时出现的问题。它在适当的等待期后开始工作。虽然我不确定那个时期是什么,但是我发现依赖它的子程序在几分钟后按预期工作(它们等待,然后在遇到故障时再重新尝试)。

由于这是一个长期运行的过程,此问题现在不应该有很大的成本。但是,如果我不得不猜测,似乎StdLib可能有一个加载延迟,可能会阻止启动线程,但不会阻止其他线程。

相关问题