[python-win32] Problem with msvcr90.dll

Tefnet Developers developers at tefnet.pl
Tue Feb 1 17:11:57 CET 2011

Dnia 2011-02-01, wto o godzinie 10:44 +1100, Mark Hammond pisze:
> This stuff is painful and poorly documented.  Is it possible the code 
> which triggers the failing import is on a different thread than the one 
> which loaded Python?  If so, I suspect the magic done by Python in 
> dl_nt.c may not be kicking in, which is supposed to ensure all python 
> modules are loaded using the "activation context" defined by pythonxx.dll.

The smallest piece of program that shows the problem:

$ cat pytest.c
#include <Python.h>

int main(void) {
                "import traceback \n"
                "       import pywintypes\n"
                "       traceback.print_exc()\n"

$ make pytest.exe
i586-mingw32msvc-gcc -I./include -I./include/python -Wall -pedantic
-std=c99    -c -o pytest.o pytest.c

i586-mingw32msvc-gcc -L./lib -o pytest.exe pytest.o -lmingw32 -lpython26
rm pytest.o


The output looks like this:

Traceback (most recent call last):
  File "<string>", line 3, in <module>
  File "C:\Python26\lib\site-packages\win32\lib\pywintypes.py", line
124, in <module>
    __import_pywin32_system_module__("pywintypes", globals())
  File "C:\Python26\lib\site-packages\win32\lib\pywintypes.py", line 64,
in __import_pywin32_system_module__
    import _win32sysloader
ImportError: DLL load failed: The specified module could not be found


It loads fine if I add -lmsvcr90 to the linking flags, but I think it
should not be necessary, right?

Filip Zyzniewski

More information about the python-win32 mailing list