pywin32 icon indicating copy to clipboard operation
pywin32 copied to clipboard

AttributeError: module 'win32com.gen_py.00020905-0000-4B30-A977-D214852036FFx0x3x0' has no attribute 'CLSIDToClassMap'

Open ykallan opened this issue 4 years ago • 4 comments

i had try install pywin32 in a conda env, and use it by: from win32com import client word = client.Dispatch("Word.Application") and catch an error , like :

Traceback (most recent call last): File "F:/xxx/code/2021_04/xxxx/trans_doc_2_docx.py", line 36, in <module> doc2docx(abs_doc) File "F:/xxx/code/2021_04/xxxx/trans_doc_2_docx.py", line 8, in doc2docx word = client.Dispatch("Word.Application") File "C:\ProgramData\Anaconda3\envs\ml\lib\site-packages\win32com\client\__init__.py", line 96, in Dispatch return __WrapDispatch(dispatch, userName, resultCLSID, typeinfo, clsctx=clsctx) File "C:\ProgramData\Anaconda3\envs\ml\lib\site-packages\win32com\client\__init__.py", line 37, in __WrapDispatch klass = gencache.GetClassForCLSID(resultCLSID) File "C:\ProgramData\Anaconda3\envs\ml\lib\site-packages\win32com\client\gencache.py", line 183, in GetClassForCLSID mod = GetModuleForCLSID(clsid) File "C:\ProgramData\Anaconda3\envs\ml\lib\site-packages\win32com\client\gencache.py", line 226, in GetModuleForCLSID mod = GetModuleForTypelib(typelibCLSID, lcid, major, minor) File "C:\ProgramData\Anaconda3\envs\ml\lib\site-packages\win32com\client\gencache.py", line 266, in GetModuleForTypelib AddModuleToCache(typelibCLSID, lcid, major, minor) File "C:\ProgramData\Anaconda3\envs\ml\lib\site-packages\win32com\client\gencache.py", line 552, in AddModuleToCache dict = mod.CLSIDToClassMap AttributeError: module 'win32com.gen_py.00020905-0000-4B30-A977-D214852036FFx0x3x0' has no attribute 'CLSIDToClassMap'

i has install pywin32 by conda and pip, and, ether can use the code.

pywin32 info:

` argon2-cffi 20.1.0 async-generator 1.10 attrs 20.3.0 backcall 0.2.0 bleach 3.3.0 certifi 2020.12.5 cffi 1.14.5 colorama 0.4.4 decorator 5.0.6 defusedxml 0.7.1 entrypoints 0.3 importlib-metadata 3.10.0 ipykernel 5.3.4 ipython 7.22.0 ipython-genutils 0.2.0 ipywidgets 7.6.3 jedi 0.17.0 Jinja2 2.11.3 joblib 1.0.1 jsonschema 3.2.0 jupyter 1.0.0 jupyter-client 6.1.12 jupyter-console 6.4.0 jupyter-core 4.7.1 jupyterlab-pygments 0.1.2 jupyterlab-widgets 1.0.0 MarkupSafe 1.1.1 mistune 0.8.4 mkl-fft 1.3.0 mkl-random 1.1.1 mkl-service 2.3.0 nbclient 0.5.3 nbconvert 6.0.7 nbformat 5.1.3 nest-asyncio 1.5.1 notebook 6.3.0 numpy 1.19.2 packaging 20.9 pandocfilters 1.4.3 parso 0.8.2 pickleshare 0.7.5 pip 21.0.1 prometheus-client 0.10.1 prompt-toolkit 3.0.17 pycparser 2.20 Pygments 2.8.1 pyparsing 2.4.7 pyrsistent 0.17.3 python-dateutil 2.8.1 pywin32 227 pywinpty 0.5.7 pyzmq 20.0.0 qtconsole 5.0.3 QtPy 1.9.0 scikit-learn 0.24.1 scipy 1.6.2 Send2Trash 1.5.0 setuptools 52.0.0.post20210125 six 1.15.0 terminado 0.9.4 testpath 0.4.4 threadpoolctl 2.1.0 tornado 6.1 traitlets 5.0.5 typing-extensions 3.7.4.3 wcwidth 0.2.5 webencodings 0.5.1 wheel 0.36.2 widgetsnbextension 3.5.1 wincertstore 0.2 zipp 3.4.1

`

if you know how to deal with please concat me at [email protected] ,

thak you.

ykallan avatar Apr 27 '21 08:04 ykallan

i just uninstall pywin32=227 , and, install pywin32=300, and got the same error

ykallan avatar Apr 27 '21 09:04 ykallan

Sorry for the huge delay. I'd need to know what is in 00020905-0000-4B30-A977-D214852036FFx0x3x0.py

mhammond avatar Sep 11 '21 09:09 mhammond

Ran into the same issue. In my case, the exact exception was:

AttributeError: module 'win32com.gen_py.00020905-0000-0000-C000-000000000046x0x8x7' has no attribute 'CLSIDToPackageMap'

Based on the suggestion in this gist, I took a look at %TEMP\gen_py.

There was a folder named 00020905-0000-0000-C000-000000000046x0x8x7, but all it contained was an empty __pycache__ dir. No .py or .pyc files present. Let me know if there's any other info that could help, or any steps that could reproduce this reliably.

colatkinson avatar Mar 10 '22 18:03 colatkinson

I met similar exception, and I just delete %TEMP\gen_py\*. No error raises : )

Vitotian avatar Jun 17 '22 01:06 Vitotian

FYI, it's not %TEMP\gen_py but rather %TEMP%\gen_py (2 percents signs around the variable).

jfthuong avatar Nov 23 '22 10:11 jfthuong