"ImportError DLL load failed The specified module could not be found"

Last edited on

Symptoms

On Windows, you are getting one of the following errors while trying to load a Python module in a Squish test script written in Python:

ImportError: DLL load failed: The specified module could not be found.

ImportError: DLL load failed: Das angegebene Modul wurde nicht gefunden.

Solution

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.

The only known solution to this is to add a manifest which specifies the runtime of the Python module’s binary file to the file <SQUISH_DIR>\lib_squishrunner.exe.

For example, if the module’s binary (e.g. C:\Python27\Lib\site-packages\pyodbc.pyd for the pyodbc module) was compiled with MSVC9 (you can check this with Analyzing dependencies with Dependency Walker ), 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>
A possible MSVC9 manifest (actually retrieved from pyodbc.pyd)

Adding/setting manifests is explained in Manifests .