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.
HTH,
Mark
On 31/01/2011 10:54 PM, Tefnet Developers wrote:
Hi,
I am developing a msgina replacement.
I am at the point where I have the whole Gina API handled in python (a
dll written in C, calling methods of a python object).
My problem is that somehow my program cannot import pywin32 modules:
Jan 31 12:12:41 p11 pygina: callproxy.caller: File"c:\teflogon\system_nt.py",
line 4, in<module>
Jan 31 12:12:41 p11 pygina: callproxy.caller: import pywintypes
Jan 31 12:12:41 p11 pygina: callproxy.caller:
File"C:\Python26\lib\site-packages\win32\lib\pywintypes.py", line 124,
in<module>
Jan 31 12:12:41 p11 pygina: callproxy.caller:
__import_pywin32_system_module__("pywintypes", globals())
Jan 31 12:12:41 p11 pygina: callproxy.caller:
File"C:\Python26\lib\site-packages\win32\lib\pywintypes.py", line 64, in
__import_pywin32_system_module__
Jan 31 12:12:41 p11 pygina: callproxy.caller: import _win32sysloader
Jan 31 12:12:41 p11 pygina: callproxy.caller: ImportError: DLL load failed: The
specified module could not be found
I did a check and replaced the failing method with execution of
python.exe running the same code:
if __name__ != '__main__':
subprocess.call(
[r'c:\python26\python.exe',
r'c:\teflogon\tefgina.py', pMessage],
)
And pywintypes gets imported fine there.
My dll is built using mingw, like this:
i586-mingw32msvc-gcc -L./lib -shared -Wl,--kill-at pygina.o -o
pygina.dll -lpython26
I thought it had something to do with msvcr90.dll, so I've tried the
following:
1. Adding -lmsvcr90 at the end of the linking command
2. Including a manifest in the dll:
$ cat pygina.dll.manifest
<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>
$ grep manifest pygina.rc.in
2 RT_MANIFEST pygina.dll.manifest
$
But it did not change a thing.
So the question is - why can python.exe load pywin32 modules and my dll
cannot?
I have been stuck with this for a couple of days now and any pointers
would be great :).
Thanks,
Filip Zyzniewski
Tefnet
_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32
_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32