简体   繁体   English

win32com.client.Dispatch(“Outlook.Application”)错误pywintypes.com_error:( - 2147221005,'无效的类字符串',无,无)

[英]win32com.client.Dispatch(“Outlook.Application”) error pywintypes.com_error: (-2147221005, 'Invalid class string', None, None)

I am on windows 7 and I have windows live installed. 我在Windows 7上安装了Windows Live。 Now when I am trying to run following code 现在,当我尝试运行以下代码时

import win32com.client
win32com.client.Dispatch("Outlook.Application")

I am getting following error 我收到了以下错误

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python27\lib\site-packages\win32com\client\__init__.py", line 95, in
Dispatch
    dispatch, userName = dynamic._GetGoodDispatchAndUserName(dispatch,userName,c

    lsctx)
      File "C:\Python27\lib\site-packages\win32com\client\dynamic.py", line 108, in
    _GetGoodDispatchAndUserName
        return (_GetGoodDispatch(IDispatch, clsctx), userName)
      File "C:\Python27\lib\site-packages\win32com\client\dynamic.py", line 85, in _
    GetGoodDispatch
        IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx, pythoncom.II
    D_IDispatch)
    pywintypes.com_error: (-2147221005, 'Invalid class string', None, None)

I have another machine with windows xp and Outlook installed. 我有另一台安装了Windows XP和Outlook的机器。 I ran the same code and I got the same error. 我运行相同的代码,我得到了同样的错误。

One more question. 还有一个问题。 How can I get the com of windows live on windows 7? 如何在Windows 7上获得Windows的com?

Any suggestions and comments will be appreciated. 任何建议和意见将不胜感激。

This is an indication that Outlook is not installed. 这表示未安装Outlook。 " windows live " or " outlook.com " would not help you. windows live ”或“ outlook.com ”对你没有帮助。

I was having a similar error. 我遇到了类似的错误。 Have you tried running makepy.py from win32com's folder to create entries for the different COMobject's you are using? 您是否尝试从win32com的文件夹中运行makepy.py来为您正在使用的不同COM对象创建条目? Basically, win32com just treats all of applications you interact with as default COMobjects until you let it learn about the programs installed on your computer. 基本上,win32com只会将您与之交互的所有应用程序视为默认的COM对象,直到您了解计算机上安装的程序为止。 You'll have to run makepy.py for each program you want to control with it. 您必须为要使用它控制的每个程序运行makepy.py.

After I ran it, I gained access to much more control for Outlook. 运行它之后,我获得了对Outlook的更多控制权。 It has opened other errors that I am working on correcting. 它已经打开了我正在纠正的其他错误。

Also, if you take your comobject ( comboject = win32com.client.Dispatch("Outlook.Application") ) and look at comboject._prop_map_get_.keys() you'll see all the things you can use for that program. 此外,如果您使用comobject( comboject = win32com.client.Dispatch(“Outlook.Application”) )并查看comboject._prop_map_get_.keys(),您将看到可以用于该程序的所有内容。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 com_error: (-2147221005, '无效的 class 字符串', 无, 无) - com_error: (-2147221005, 'Invalid class string', None, None) 错误 com_error: (-2147221005, &#39;Invalid class string&#39;, None, None) 在将数据帧写入 excel 二进制笔记本时 - Error com_error: (-2147221005, 'Invalid class string', None, None) while writing dataframe into excel binary notebook python-尝试打开(大)Excel时win32com.client:pywintypes.com_error - Python - win32com.client: pywintypes.com_error when trying to open a (large) Excel 将Win32client SAPI.SpVoice与多线程一起使用会导致pywintypes.com_error - Using win32client SAPI.SpVoice with multi-threading leads to pywintypes.com_error win32com.client.Dispatch类标签 - win32com.client.Dispatch Class Label xlwings错误:pywintypes.com_error:(-2147352573,&#39;找不到成员。&#39;,无,无) - xlwings error: pywintypes.com_error: (-2147352573, 'Member not found.', None, None) pywintypes.com_error:(-2147221008,'CoInitialize 尚未被调用。',无,无) - pywintypes.com_error: (-2147221008, 'CoInitialize has not been called.', None, None) 使用 python win32com 创建数据透视图会导致 pywintypes.com_error - create a pivotchart with python win32com causes pywintypes.com_error Python 3:win32com object.Size抛出异常(pywintypes.com_error) - Python 3: win32com object.Size throws exception (pywintypes.com_error) 使用 win32com 通过 Python 访问 Outlook.Application 导致错误 - Accessing Outlook.Application via Python using win32com results in error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM