0
我是python的新手。我想讀的python .MSG文件並執行解析 目前我想下面的代碼如何在python中打開.MSG文件
def read_mail(msg):
import win32com.client
outlook = win32com.client.Dispatch("Outlook.Application").GetNamespace("IMAP")
msg=outlook.OpenSharedItem(msg)
mail_list=[];
mail_list.append(msg.SenderName)
mail_list.append(msg.SenderEmailAddress)
mail_list.append(msg.SentOn)
mail_list.append(msg.Subject)
mail_list.append(msg.Body)
del outlook, msg
return mail_list
msg=("samples\\UseCase1.msg")
read_mail(msg)
我收到錯誤這樣
IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx, pythoncom.IID_IDispatch)
com_error: (-2146959355, 'Server execution failed', None, None)