[python-win32] embedded python can't import win32api

David M. Cotter dave at kjams.com
Wed Sep 4 17:53:20 CEST 2013


I'm embedding Python27 in my app. I have users install ActivePython27 in order to take advantage of python in my app, so the python installation can't be touched as it's on the end user's machine.

When I attempt to do:
>import win32api

i get this:
>Traceback (most recent call last):
> File "startup.py", line 5, in
>ImportError: DLL load failed: The specified module could not be found.

I someone suggested i manually load the dependent libraries in the correct order, like this:

>import pywintypes
>import pythoncom
>import win32api

but then i get this:
>Traceback (most recent call last):
> File "startup.py", line 3, in
> File "C:\Python27\lib\site-packages\win32\lib\pywintypes.py", line 124, in
> __import_pywin32_system_module__("pywintypes", globals())
> File "C:\Python27\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.

the ultimate goal here is actually to do this:
>from win32com.client.gencache import EnsureDispatch

which currently yields:
>Traceback (most recent call last):
> File "startup.py", line 3, in
> File "C:\Python27\lib\site-packages\win32com\__init__.py", line 5, in
> import win32api, sys, os
>ImportError: DLL load failed: The specified module could not be found.

So, if anyone has any idea, that would be super duper great. thanks so much!

notes:
my paths are definitely set correctly, as i used the activepython installer
when i run my script the first thing i see in the output window is:

> 'kJams 2 Debug.exe': Loaded 'C:\Python27\Lib\site-packages\win32\win32api.pyd'
> 'kJams 2 Debug.exe': Loaded 'C:\Windows\SysWOW64\pywintypes27.dll'
> 'kJams 2 Debug.exe': Unloaded 'C:\Python27\Lib\site-packages\win32\win32api.pyd'
> 'kJams 2 Debug.exe': Unloaded 'C:\Windows\SysWOW64\pywintypes27.dll'

so i know it is finding those libraries

i've searched the intertubes and found many, many people with this problem, over the years, but no real solutions. "reinstall" they say, well, i've done that several times. anyone know why this is?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20130904/9e490b24/attachment.html>


More information about the python-win32 mailing list