python-3.xwin32com

Why am I suddenly getting a no attribute 'CLSIDToPackageMap' error with win32com.client?


The code

import win32com.client as win32 
Excel = win32.gencache.EnsureDispatch('Excel.Application') 

used to work, but now it produces the error:

AttributeError: 'module' object has no attribute 'CLSIDToPackageMap'

what's going on?


Solution

  • After deleting C:\Temp\gen_py, the code above works again. Hope it can save trouble!

    PS. Or, you can try searching gen_py in your %TEMP% folder;