pywin32 icon indicating copy to clipboard operation
pywin32 copied to clipboard

__import_pywin32_system_module_ function is not finding pywintypesXX.dll even if it exists

Open Ilyeshaddad337 opened this issue 1 year ago • 1 comments

Expected behavior and actual behavior

when I import the win32com.client module i get this error python DLL load failed: The specified module could not be found the line producing the error is : python \venv\lib\site-packages\win32\lib\pywintypes.py line 118 in __pywin32_system_module__ mod = importlib.util.module_from_spec(spec) when i print the spec variable that is defined just above that line i see that it contains the correct path to the dll: python ModuleSpec(name='pywintypes', loader=<_frozen_importlib_external.ExtensionFileLoader object at 0x0000020060A79208>, origin='C:\\Users\\ilyes\\Documents\\venv\\lib\\site-packages\\pywin32_system32\\pywintypes37.dll')

Steps to reproduce the problem

just import the win32com.client module

System information

Python version and distribution: python3.7 , windows

pywin32 version: pywin32==306 installed via pip

Windows Version: windows 10 22H2 19045.4412 installed on virtual machine

DLL locations: pythoncom37.dll pywintypes37.dll are found on venv\lib\site-packages\pywin32_system32\

Ilyeshaddad337 avatar Jun 21 '24 22:06 Ilyeshaddad337

This probably means the dependencies for pywintypes37.dll can't be found - eg, maybe the MSVC redistributables. A "dependency" tool, such as https://www.dependencywalker.com/, might be able to shed more light here.

mhammond avatar Jun 24 '24 15:06 mhammond