C# IronPython有时导入模块,但不导入其他模块

C# IronPython有时导入模块,但不导入其他模块,c#,ironpython,C#,Ironpython,简短的版本是,这似乎不是一个代码问题(尽管如果任何人有一个编程解决方案,让我保留设计结构,这也会起作用)。在某些情况下,当我尝试导入任何模块时,它都无法正常工作 import sys sys.path.append('C:\Python26\Lib') sys.path.append('C:\Users\<user>\Documents\Visual Studio 2010\Projects\<Solution>\Simulation') import time # er

简短的版本是,这似乎不是一个代码问题(尽管如果任何人有一个编程解决方案,让我保留设计结构,这也会起作用)。在某些情况下,当我尝试导入任何模块时,它都无法正常工作

import sys
sys.path.append('C:\Python26\Lib')
sys.path.append('C:\Users\<user>\Documents\Visual Studio 2010\Projects\<Solution>\Simulation')
import time # errors out
from XMLRPCBridge.python_ClientAPI.AsyncXMLRPCClient import AsyncXMLRPCClient, RPCPriority # if I remove the previous line this one errors instead
当我从项目中的一个虚拟主线程实例化这个类时,一切都很好 然而,当我从另一个项目间接加载它时,我会得到关于“没有这样的模块”的错误

public sealed class SimulationDriver
{
    private static readonly Lazy<SimulationDriver> lazy = new Lazy<SimulationDriver>(() => new SimulationDriver());
    private StateSimBridge.StateSimBridge simulationBridge = new StateSimBridge.StateSimBridge("Garmsir");

    static SimulationDriver()
    {
    }

    private SimulationDriver()
    {
    }

    public static SimulationDriver Instance
    {
        get { return lazy.Value;  }
    }
    ...
}
公共密封类模拟驱动程序
{
private static readonly Lazy Lazy=new Lazy(()=>new SimulationDriver());
private StateSimBridge.StateSimBridge simulationBridge=新StateSimBridge.StateSimBridge(“Garmsir”);
静态模拟驱动程序()
{
}
专用模拟驱动程序()
{
}
公共静态模拟驱动程序实例
{
获取{return lazy.Value;}
}
...
}
我甚至不确定在这一点上还需要测试什么,所以非常感谢您的帮助


编辑:为了清楚起见,我在两种情况下都检查了sys.path,并且两个条目都成功添加。让我困惑的是,就IronPython而言,这两种情况之间存在差异。

这可能是C-p错误,但我敢打赌

sys.path.append('C:\Python26\Lib')
sys.path.append('C:\Users\<user>\Documents\Visual Studio 2010\Projects\<Solution>\Simulation')

还可能显示路径是否正确。

问题是IronPython分布在两个库文件(IronPython.dll和IronPython.Modules.dll)中。我在项目中运行的测试运行得很好,但在其他项目中不起作用,因为(无论出于何种原因)构建过程只导入了IronPython.dll,而没有导入模块库。

非常感谢您的输入,我尝试了一下,只是为了确保(没有任何区别)。但正如我所提到的,在一种情况下在IronPython下运行时,它工作得很好,而不是在另一种情况下。当作为纯Python运行时,它也可以正常工作。我还尝试在两种情况下打印路径,结果都是一样的。这两次,他们还提出了相关的路径添加。
sys.path.append('C:\Python26\Lib')
sys.path.append('C:\Users\<user>\Documents\Visual Studio 2010\Projects\<Solution>\Simulation')
sys.path.append(r'C:\Python26\Lib')
sys.path.append(r'C:\Users\<user>\Documents\Visual Studio 2010\Projects\<Solution>\Simulation')
print sys.path