Python cannot open msvcr90.dll

Python 2.6 is built into my Windows application (the old one I know, but we have to work with this). It can run basic Python commands, but does not try to execute

import ctypes
ctypes.WinDLL("msvcr90.dll")

I get Error 126 "cannot find dll". If I install a DLL where the application can find it, I get the error 1114 "DLL initialization failed to complete."

UPDATED . This can be reproduced using this simplest program:

#include <math.h>
#include <iostream>
#undef _DEBUG
#include <Python.h>

int main(int argc, char* argv[])
{
    Py_SetProgramName(argv[0]);
    Py_Initialize();
    PyRun_SimpleString("import pyreadline\n");
    Py_Finalize();
    std::cout << "Press enter: " << std::endl;
    char c;
    std::cin.read(&c, 1);
    return 0;
}

This cannot be compiled using the V9 or v10 toolchain on the x86 and amd64 architectures.

Tracking is as follows:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Python26-x86\lib\site-packages\pyreadline\__init__.py", line 9, in <m
odule>
    import unicode_helper, logger, clipboard, lineeditor, modes, console
  File "C:\Python26-x86\lib\site-packages\pyreadline\console\__init__.py", line
14, in <module>
    from console import *
  File "C:\Python26-x86\lib\site-packages\pyreadline\console\console.py", line 6
05, in <module>
    msvcrt = cdll.LoadLibrary(ctypes.util.find_msvcrt())
  File "C:\Python26-x86\Lib\ctypes\__init__.py", line 431, in LoadLibrary
    return self._dlltype(name)
  File "C:\Python26-x86\Lib\ctypes\__init__.py", line 353, in __init__
    self._handle = _dlopen(self._name, mode)
WindowsError: [Error 126] The specified module could not be found    
  -- or alternatively --
WindowsError: [Error 1114] A dynamic link library (DLL) initialization routine f
ailed

I know that the downloadable dll is msvcr90.dll because I inserted it print self._nameinto ctypes.py.

Python, , , pyreadline.

Python .

?

2 LoadLibrary("msvcr90.dll") . DLL , . . :

<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="amd64" publicKeyToken="1fc8b3b9a1e18e3b" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"></assemblyIdentity>
    </dependentAssembly>
  </dependency>
</assembly>

, python.exe, , python.exe DLL, . .

+4
1

!
- , msvcr90.dll . , , python script.
, .
add.manifest :

<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  <dependency>
    <dependentAssembly>
      <assemblyIdentity type="win32" name="Microsoft.VC90.CRT" version="9.0.21022.8" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b" ></assemblyIdentity>
    </dependentAssembly>
  </dependency>
</assembly>

Project Properties/Manifest Tool/Input and Outputs/Additional Manifest Files
processorArchitecture = " amd64".
.

+5

All Articles