I want to make an script in python that reads mails from Lotus Notes 8.5 and then create for each email an issue in jira but it returns me this error when I try to read the mails from 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)
here is my .py file
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()
Looking at 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").
I suggest either (a) not specifying a server or (b) only giving a relative path, ie mailPath = r'mail202\myname.nsf'
.