Traceback with "No such object" although there is indeed such an object (works with "ldapsearch")

Martin Winkler mw at agamisystems.eu
Wed Dec 19 15:46:53 CET 2007


Hi all,

Doing an ldapsearch in the shell works, but the same search in python
does not. I tried for a couple of hours already to no avail, so I write
here hoping that one of you might be able to give me help:

Working example (in bash shell):
================================
$ ldapsearch -x -LLL "(ou=People)" -b "dc=mydomain,dc=com"
dn: ou=People,dc=mydomain,dc=com
ou: People
objectClass: organizationalUnit
description: Users of my domain

Not working (in python shell):
==============================
>>> import ldap
>>> l = ldap.initialize("ldap://127.0.0.1")
>>> l.simple_bind_s("","")
>>> l.search_s('o=mydomain, c=com', ldap.SCOPE_SUBTREE, '(ou=People)')
    # I also tried it with   ...'ou=People'    without the parentheses
In both cases I get this traceback:
  File "<stdin>", line 1, in ?
  File "/usr/lib64/python2.3/site-packages/ldap/ldapobject.py", line
461, in search_s return
self.search_ext_s(base,scope,filterstr,attrlist,attrsonly,timeout=self.timeout)
File "/usr/lib64/python2.3/site-packages/ldap/ldapobject.py", line 455,
in search_ext_s return self.result(msgid,all=1,timeout=timeout)[1] File
"/usr/lib64/python2.3/site-packages/ldap/ldapobject.py", line 392, in
result res_type,res_data,res_msgid = self.result2(msgid,all,timeout)
File "/usr/lib64/python2.3/site-packages/ldap/ldapobject.py", line 398,
in result2 return self._ldap_call(self._l.result2,msgid,all,timeout)
File "/usr/lib64/python2.3/site-packages/ldap/ldapobject.py", line 94,
in _ldap_call result = func(*args,**kwargs) ldap.NO_SUCH_OBJECT:
{'info': '', 'desc': 'No such object'}

Does someone have an idea how I can get any results?

Martin




More information about the python-ldap mailing list