I pulled the code from how to convert xls to xlsx and it worked for about 6 weeks.
Here is my implementation
import win32com.client as win32
excel = win32.gencache.EnsureDispatch('Excel.Application')
Then one day it just stopped, raises this error, and doesn't get any further into my code.
Traceback (most recent call last):
File "C:\Python\convert.py", line 32, in <module>
excel = win32.gencache.EnsureDispatch('Excel.Application')
File "C:\Users\jkenn\AppData\Local\Programs\Python\Python38-32\lib\site-packages\win32com\client\gencache.py", line 527, in EnsureDispatch
disp = win32com.client.Dispatch(prog_id)
File "C:\Users\jkenn\AppData\Local\Programs\Python\Python38-32\lib\site-packages\win32com\client\__init__.py", line 96, in Dispatch
return __WrapDispatch(dispatch, userName, resultCLSID, typeinfo, clsctx=clsctx)
File "C:\Users\jkenn\AppData\Local\Programs\Python\Python38-32\lib\site-packages\win32com\client\__init__.py", line 37, in __WrapDispatch
klass = gencache.GetClassForCLSID(resultCLSID)
File "C:\Users\jkenn\AppData\Local\Programs\Python\Python38-32\lib\site-packages\win32com\client\gencache.py", line 183, in GetClassForCLSID
mod = GetModuleForCLSID(clsid)
File "C:\Users\jkenn\AppData\Local\Programs\Python\Python38-32\lib\site-packages\win32com\client\gencache.py", line 226, in GetModuleForCLSID
mod = GetModuleForTypelib(typelibCLSID, lcid, major, minor)
File "C:\Users\jkenn\AppData\Local\Programs\Python\Python38-32\lib\site-packages\win32com\client\gencache.py", line 266, in GetModuleForTypelib
AddModuleToCache(typelibCLSID, lcid, major, minor)
File "C:\Users\jkenn\AppData\Local\Programs\Python\Python38-32\lib\site-packages\win32com\client\gencache.py", line 552, in AddModuleToCache
dict = mod.CLSIDToClassMap
AttributeError: module 'win32com.gen_py.00020813-0000-0000-C000-000000000046x0x1x9' has no attribute 'CLSIDToClassMap'
I am entirely self taught and this is well beyond my ability to dignose so if someone could shed some light onto why this started happening I would be very grateful.
EDIT: I found this article regarding win32com
win32.Dispatch vs win32.gencache in Python. What are the pros and cons?
I have tried both vesions and the same error appears so is there some issue with calling the 'Excel.application'?