1

I have to extract data from a Notes database automatically for a data pipeline validation. With HCL Notes I was able to connect to the database, so I know the access works. I have the following information to access the database: host (I got both hostname and ip address), domino server name, database name (.nsf filename) I tried the noteslib library in the below way:

import noteslib
db = noteslib.Database('domino server name','db filename.nsf')

I also tried adding the host to the server parameter instead, but it does not work. I receive this error:

Error connecting to ...Double-check the server and database file names, and make sure you have
read access to the database.

My question is how can I add the host and the domino server name as well (if it is required)? Notes HCL authenticates me before accessing the database using the domino server name and the .nsf file. I tried adding the password parameter to the end, but also without luck. I am on company VPN, so that also should not be an issue.

Looz
  • 377
  • 2
  • 14

2 Answers2

1

In Order for noteslib to work you need an installed and configured HCL Notes Client on that machine. Only with an installed Notes Client the needed COM registrations and the dlls to connect to Domino are present.

In addition the Notes Client and the python version you are using need to be the same bitness: If Notes Client is 32Bit then python needs to be 32Bit. If Notes Client is 64Bit (only available since 12.0.2) then python needs to be 64Bit as well.

As soon as this requirement is met, you can simply use your example by adding the password parameter as a third parameter to your command:

db = noteslib.Database('domino server name','db filename.nsf', 'yourIDPassword')

If you still get an error when connecting to the server then you might need to put the server common name and its IP address into your hosts file.

So if your Domino- Servername is

YourServer/YourOrganization

and the IP address of that server is

192.168.1.20

then you put this into your hosts:

yourserver 192.168.1.20

Tode
  • 11,795
  • 18
  • 34
  • I Have HCL Client installed, and I can access the database from there. I still receive the error after adding the server to hosts. Do you have any other guess how could I solve this? – Looz Jan 12 '23 at 13:56
  • You could try to first create a session and check if you get it: `s = noteslib.Session("password") s.NotesBuildVersion` – Tode Jan 12 '23 at 14:05
  • This way I receive another error: Error connecting to Notes via COM. – Looz Jan 12 '23 at 14:37
  • I just realized that the notes client is a 64bit version, could this be an issue? – Looz Jan 12 '23 at 14:52
  • yes, of course: all software needs to be the same bitness... So you need to uninstall this 12.0.2 64Bit Client and install the 12.0.2 32Bit client... unfortunately you tried the first -and only- version that is available in 64bit... – Tode Jan 12 '23 at 15:28
  • Sorry I was mistaken. I am using version HCL Notes Client version 11. I needed to install this from my company's app store, so I have no option to choose between 32 and64 bit versions, but as I understand correctly version 11 is only available as a 32 bit app, right? – Looz Jan 12 '23 at 17:09
  • maybe using 32 bit python as well would help? – Looz Jan 12 '23 at 17:10
  • you also mentioned in your first comment that only after having an installed and CONFIGURED notes client this would work. What did you mean by configured exactly? Maybe I am missing something. – Looz Jan 12 '23 at 17:12
  • If you can use your Notes client, then COM should work and therefor your code. Notes Client 11 is always 32Bit, in that case you need to use 32Bit python as well – Tode Jan 12 '23 at 17:14
  • 1
    oh my god, that was it. I needed the 32 bit version of python and it works like a charm! You are a lifesaver! Thank you! – Looz Jan 12 '23 at 17:20
1

You can connect using com on windows. I use this python library https://pypi.org/project/pywin32/

import win32com.client
import sys

notesServer = "Servername/Domain"
notesFile = "file.nsf"
notesPass = ""

#Connect to notes database on server
notesSession = win32com.client.Dispatch('Lotus.NotesSession')
notesSession.Initialize(notesPass)
notesDatabase = notesSession.GetDatabase(notesServer,notesFile)
Marcis
  • 66
  • 2
  • I tried your solution, but I receive the following error: pywintypes.com_error: (-2147221164, 'Class not registered', None, None) Do you have an idea how to solve this? – Looz Jan 12 '23 at 13:53
  • Could be 32bit and 64bit problem, all components should be the same. I use 32bit Notes and python. – Marcis Jan 13 '23 at 08:09
  • That was the issue, I used 64 bit python with 32 bit notes. 32 bit python solved the problem. Thank you for your help! – Looz Jan 13 '23 at 11:58