Office automation, error'win32com.gen_py....' has no attribute'CLSIDToClassMap'

Original address: https://mlln.cn/2018/04/23/win32com-gen-py%E9%94%99%E8%AF%AFhas-no-attribute-CLSIDToClassMap/

Error code:

import win32com.client as win32
word = win32.gencache.EnsureDispatch('Word.Application') ## 报错位置

Error prompt:

AttributeError: module ‘win32com.gen_py.00020905-0000-0000-C000-000000000046x0x8x5’ has no attribute ‘CLSIDToClassMap’

Solution: Just delete C:\Users\Erica\AppData\Local\Temp\gen_py\3.7the cache folder in the directory , 00020905-0000-0000-C000-000000000046x0x8x5and re-execute the above code and no more errors will be reported.

Tip:
Use Everything search gen_pyto determine gen_pythe location of the folder .

Guess you like

Origin blog.csdn.net/caviar126/article/details/114238985