Я пытаюсь подключиться к Outlook с помощью Python, но следующая строка выдает com_error
outlook = win32com.client.Dispatch("Outlook.Application").GetNamespace("MAPI")
Полная трассировка выглядит следующим образом:
---------------------------------------------------------------------------
com_error Traceback (most recent call last)
c:\users\dipf5\appdata\local\programs\python\python37\lib\site-packages\win32com\client\dynamic.py in _GetGoodDispatch(IDispatch, clsctx)
88 try:
---> 89 IDispatch = pythoncom.connect(IDispatch)
90 except pythoncom.ole_error:
com_error: (-2147221005, 'Invalid class string', None, None)
During handling of the above exception, another exception occurred:
com_error Traceback (most recent call last)
<ipython-input-15-a96a5314c4a3> in <module>
----> 1 outlook = win32com.client.Dispatch("Outlook.Application").GetNamespace("MAPI")
c:\users\dipf5\appdata\local\programs\python\python37\lib\site-packages\win32com\client\__init__.py in Dispatch(dispatch, userName, resultCLSID, typeinfo, UnicodeToString, clsctx)
93 """
94 assert UnicodeToString is None, "this is deprecated and will go away"
---> 95 dispatch, userName = dynamic._GetGoodDispatchAndUserName(dispatch,userName,clsctx)
96 return __WrapDispatch(dispatch, userName, resultCLSID, typeinfo, clsctx=clsctx)
97
c:\users\dipf5\appdata\local\programs\python\python37\lib\site-packages\win32com\client\dynamic.py in _GetGoodDispatchAndUserName(IDispatch, userName, clsctx)
112 else:
113 userName = str(userName)
--> 114 return (_GetGoodDispatch(IDispatch, clsctx), userName)
115
116 def _GetDescInvokeType(entry, invoke_type):
c:\users\dipf5\appdata\local\programs\python\python37\lib\site-packages\win32com\client\dynamic.py in _GetGoodDispatch(IDispatch, clsctx)
89 IDispatch = pythoncom.connect(IDispatch)
90 except pythoncom.ole_error:
---> 91 IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx, pythoncom.IID_IDispatch)
92 else:
93 # may already be a wrapped class.
com_error: (-2147221005, 'Invalid class string', None, None)
Любое предложение будет полезным.