我有一个运行了3个月的代码,直到现在,我开始看到错误,不确定哪些需要修改
我的原始代码是:
import pandas as pd
import win32com.client
outlook = win32com.client.Dispatch("Outlook.Application")
namespace = outlook.GetNamespace("MAPI")
root_folder = namespace.Folders.Item(3)
subfolder = root_folder.Folders['Inbox'].Folders['Daily Process']
messages = subfolder.Items
message = messages.GetFirst()
subj_line = message.subject然而,我得到了以下错误
com_error: (-2147352567, 'Exception occurred.', (4096, 'Microsoft Outlook', 'The attempted operation failed. An object could not be found.', None, 0, -2147221233), None)我分解了我的代码,似乎没有再定义'MAPI‘这个名字
import pandas as pd
import win32com.client
outlook = win32com.client.Dispatch("Outlook.Application")
namespace = outlook.GetNamespace("MAPI")
your_folder = namespace.Folders['Inbox'].Folders['Daily Process']
for message in your_folder.Items:
print(message.Subject)这给了我
name 'mapi' is not defined发布于 2021-07-11 03:09:55
尝试小写:
outlook = win32com.client.Dispatch("outlook.application")当我把大写的Outlook
https://stackoverflow.com/questions/55538550
复制相似问题