gpt4 book ai didi

Python : How can I access Lotus Notes 8. 5 收件箱阅读邮件

转载 作者:太空宇宙 更新时间:2023-11-03 14:14:22 25 4
gpt4 key购买 nike

我想在 python 中创建一个脚本,该脚本从 Lotus Notes 8.5 读取邮件,然后在 jira 中为每封电子邮件创建一个问题,但是当我尝试从 Lotus 读取邮件时它会返回此错误:

Traceback (most recent call last):
File "from_Lotus_TO_Jira.py", line 46, in <module>
main()
File "from_Lotus_TO_Jira.py", line 39, in main
folder = notesDatabase.GetView('$Inbox')
File "C:\Python27\lib\site-packages\win32com\gen_py\29131520-2EED-1069-BF5D-00
DD011186B7x0x1x2.py", line 1849, in GetView
ret = self._oleobj_.InvokeTypes(1610743866, LCID, 1, (9, 0), ((8, 1),),pName

pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, u'NotesDatabase',
u'Database server_name!!C:\\Users\\MYNAME\\AppData\\Local\\Lotus\\Notes\\Data\\ma
il202\\myname.nsf has not been opened yet', None, 0, -2147217441), None)

这是我的 .py 文件

import win32com.client
import pywintypes
import getpass

def main():
# Get credentials
mailServer = 'server_name'
mailPath = 'C:\Users\MYNAME\AppData\Local\Lotus\Notes\Data\mail202\myname.nsf'


mailPassword = ''
# Connect
notesSession = win32com.client.Dispatch('Lotus.NotesSession')



notesSession.Initialize(mailPassword)
notesDatabase = notesSession.GetDatabase(mailServer, mailPath)

# Get a list of folders
folder = notesDatabase.GetView('$Inbox')
document = folder.GetFirstDocument()



if __name__ == "__main__":
main()

最佳答案

查看http://www-01.ibm.com/support/docview.wss?uid=swg21308538

The full filepath (e.g. "C:\notes\data\r_apps\haha.nsf") may optionally be used when accessing local databases on a workstation. If you specify a server name, however, or if the code is running on a server, you must use the path relative to the Notes data directory ("r_apps\haha.nsf").

我建议 (a) 不指定服务器或 (b) 仅提供相对路径,即 mailPath = r'mail202\myname.nsf'

关于Python : How can I access Lotus Notes 8. 5 收件箱阅读邮件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34659861/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com