Search w/ win2000

Michael Ströder michael at
Thu Sep 26 14:39:41 CEST 2002

Richard.Ferry at wrote:
 > I have version ldap-1.10a3 installed. I am running on a python 2.2 on
 > a win2000 system.

Which LDAP server? Active Directory? Note that python-ldap 1.x cannot
open an LDAPv3 connection. It's limited to LDAPv2 which is not allowed
with Active Directory I suspect. There are other caveats of 1.x and LDAPv2.

Unfortunately there's currently no Win32 build available of python-ldap 
2.x which is based on OpenLDAP 2.x libs.

 > I have been unable to make the search work. Below are some of my
 > unsuccessful tries. Can I use the "_s" option on the version

The synchronous method search_s() is what you probably like to use. It
returns the search result als list of 2-tuples containing the
distinguished name (string) and the entry (dictionary).

 > Traceback (most recent call last):
 >   File "C:\Python22\", line 3, in ?
 >     l.simple_bind_s('uid=xxxxx,ou=myou,o=myorg','xxxxx')
 > LOCAL_ERROR: {'desc': 'Local error'}

More information about your setup is needed. Which server? Is simple 
authentication enabled at the server at all?

 > l.simple_bind('uid=xxxxx,ou=myou,o=myorg','xxxxx')

You should use the synchronous version for binding in any case.


 > res ='o=myorg', ldap.SCOPE_BASE,
 > 'uid=xxxxx,ou=myou,o=myorg',
 > ["ou", "l"])
 > for entry in res:
  > [..]
 > This code gives me this error msg: TypeError: iteration over
 > non-sequence

search() in opposite to search_s() returns an integer representing the
message ID of the started LDAP operation which is then used when calling
result(). That's probably not what you want.

Ciao, Michael.

More information about the python-ldap mailing list