Trying to track down msgid associated with ldap.NO_SUCH_OBJECT exception

Chris Dukes pakrat at
Wed Oct 21 22:59:58 CEST 2009

I'm trying to create a python port of a perl script to update an LDAP directory
against an LDIF file.
As I read LDIF entries I do an
mesgid =, ldap.SCOPE_BASE, '(objectclass=*)', ['*'])

I am currently keeping the ldif entries in a dict indexed by the msgid
so I may retrieve them for comparison as they come back from 

As this is for updates, I am expecting the occasional ldap.NO_SUCH_OBJECT
exception.  Unfortunately, this exception does not provide the msgid
associated with the ldap.NO_SUCH_OBJECT.

Would it be possible for the msgid to be included in the dictionary that also
{'matched': 'dc=COM', 'desc': 'No such object'}

Chris Dukes
"In cynicism she's about 35" -- Terry Pratchett's "Hog Father"

More information about the python-ldap mailing list