can't find win32api from embedded pyrun call

David M. Cotter me at davecotter.com
Tue Sep 3 16:50:27 EDT 2013


I find i'm having this problem, but the solution you found isn't quite specific enough for me to be able to follow it. 

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 a user's machine.

When I attempt to do:
>import win32api

i get this:
>Traceback (most recent call last):
>  File "startup.py", line 5, in <module>
>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 <module>
>  File "C:\Python27\lib\site-packages\win32\lib\pywintypes.py", line 124, in <module>
>    __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 <module>
>  File "C:\Python27\lib\site-packages\win32com\__init__.py", line 5, in <module>
>    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



More information about the Python-list mailing list