[python-win32] Calling Dispatch - Error -2147221005
The Big 3on3
thebig3on3 at gmail.com
Mon Jul 19 20:57:33 EDT 2021
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.python.org/pipermail/python-win32/attachments/20210719/69bbf438/attachment.html>
More information about the python-win32
mailing list