[python-win32] Calling Dispatch - Error -2147221005

2021-07-20 Thread Steven Manross
Seems like you have the class string invalid…

“Outlook Application” should read “Outlook.Application”

Note the period.  

And then of course, you need Outlook installed, and the correct 32-bit or 
64-bit version of Outlook for your python version.

HTH and Enjoy

Steven
___
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32


[python-win32] Calling Dispatch - Error -2147221005

2021-07-19 Thread The Big 3on3
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 
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
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32