“importError DLL加载失败指定的模块无法找到”

最后编辑了

症状

在Windows上,您在尝试在Python中编写的蜂鸣测试脚本中加载Python模块时,您正在获得以下错误之一:

ImportError:DLL加载失败:找不到指定的模块。

ImportError:DLL Load失败:DAS Bygebene Modul Wurde Nicht Gefunden。

解决方案

This is known to be caused by <SQUISH_DIR>\lib\_squishrunner.exe being compiled with a different compiler (or compiler version) than the binary file that the respective Python module consists of.

唯一已知的解决方案是添加一个清单,该清单指定Python模块的运行时’s binary file to the file <SQUISH_DIR>\lib_squishrunner.exe.

例如,如果模块’s binary (e.g. C:\Python27\Lib\site-packages\pyodbc.pyd for the pyodbc module) was compiled with MSVC9 (you can check this with 使用依赖步行者分析依赖项 ), then a manifest similar to the following may have to be added to _squishrunner.exe:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
    <security>
      <requestedPrivileges>
        <requestedExecutionLevel level="asInvoker" uiAccess="false"></requestedExecutionLevel>
      </requestedPrivileges>
    </security>
  </trustInfo>
  <dependency>
    <dependentAssembly>
      <assemblyIdentity type="win32" name="Microsoft.VC90.CRT" version="9.0.21022.8" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
    </dependentAssembly>
  </dependency>
</assembly>
可能的msvc9清单(实际从pyodbc.pyd中检索)

添加/设置清单中解释 表明 .