import pythoncom fails with conda (pywintypes27.dll and pythoncom27.dll not found)
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
With pywin32 build 219 installed via conda on python 2.7, importing pythoncom fails with
ImportError: No system module 'pywintypes' (pywintypes27.dll)
The issue is that the library pywintypes27.dll is stored not in
pathtovenv\lib\site-packages\win32\lib\pywintypes27.dll
but in
pathtovenv\lib\site-packages\win32\pywintypes27.dll
Adding in the file win32\lib\pywintypes.py the elif part herebelow solves the issue
:::python
if found is None:
# Not in the Python directory? Maybe we were installed via
# easy_install...
if os.path.isfile(os.path.join(os.path.dirname(__file__), filename)):
found = os.path.join(os.path.dirname(__file__), filename)
elif os.path.isfile(os.path.join(os.path.dirname(__file__), "..", filename)):
found = os.path.join(os.path.dirname(__file__), "..", filename)