Calling Dispatch - Error -2147221005

The Big 3on3 <[email protected]>
Newsgroups gmane.comp.python.windows
Message-ID <CA+67nohMAywzdtAxSjUBJjCWfjyOUZ7a_9=n2NwY4mjAxMDmcw@mail.gmail.com>
Earlier today I downloaded the pywin package to work with Microsoft
Outlook. On the below code I received Error -2147221005. I'm uncertain if
this has to do with an installation of the library not working
properly/version issues. I use a 32 bit version of Python 3.7.

*Python Code:*

import win32com.client as client
outlook = client.Dispatch("Outlook Application")
message = outlook.CreateItem(0)
message.Display()

*Full Error Message:*
Traceback (most recent call last):
  File
"C:\Users\Eric\AppData\Local\Programs\Python\Python37-32\lib\site-packages\win32com\client\dynamic.py",
line 81, in _GetGoodDispatch
    IDispatch = pythoncom.connect(IDispatch)
pywintypes.com_error: (-2147221005, 'Invalid class string', None, None)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "Outlook_text_text.py", line 2, in <module>
    outlook = client.Dispatch("Outlook Application")
  File
"C:\Users\Eric\AppData\Local\Programs\Python\Python37-32\lib\site-packages\win32com\client\__init__.py",
line 95, in Dispatch
    dispatch, userName =
dynamic._GetGoodDispatchAndUserName(dispatch,userName,clsctx)
  File
"C:\Users\Eric\AppData\Local\Programs\Python\Python37-32\lib\site-packages\win32com\client\dynamic.py",
line 98, in _GetGoodDispatchAndUserName
    return (_GetGoodDispatch(IDispatch, clsctx), userName)
  File
"C:\Users\Eric\AppData\Local\Programs\Python\Python37-32\lib\site-packages\win32com\client\dynamic.py",
line 83, in _GetGoodDispatch
    IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx,
pythoncom.IID_IDispatch)
pywintypes.com_error: (-2147221005, 'Invalid class string', None, None)

Thanks in advance.

Best,
Eric

_______________________________________________
python-win32 mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-win32
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.