[python-win32] Dispatch suddenly generates com_error

Strijbos, Dr. R.C. R.C.Strijbos@tue.nl
Fri, 5 Jul 2002 15:07:02 +0200


As a novice to COM I seem to have done something completely wrong:

Simply typing:

import win32com.client
xl=win32com.client.Dispatch("Excel Application")

gives me the following traceback (while it has worked before):

Traceback (most recent call last):
  File "<interactive input>", line 1, in ?
  File "C:\Python22\Lib\site-packages\win32com\client\__init__.py", line 92,
in Dispatch
    dispatch, userName =
dynamic._GetGoodDispatchAndUserName(dispatch,userName,clsctx)
  File "C:\Python22\Lib\site-packages\win32com\client\dynamic.py", line 81,
in _GetGoodDispatchAndUserName
    return (_GetGoodDispatch(IDispatch, clsctx), userName)
  File "C:\Python22\Lib\site-packages\win32com\client\dynamic.py", line 72,
in _GetGoodDispatch
    IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx,
pythoncom.IID_IDispatch)
com_error: (-2147221005, 'Invalid class string', None, None)

Any suggestions how to repair the damage?

Thanks,

Remco Strijbos