Yeargan Yancey wrote:

I am trying to use the asynchronous LDAP polling feature and have a question about what appears to be a timing issue. When I run the code below, I find that I must insert a sleep() before entering the while loop or I get a ValueError exception. [..] File "/usr/lib/python2.4/site-packages/ldap/ldapobject.py", line 415, in result3 rtype, rdata, rmsgid, serverctrls = self._ldap_call(self._l.result3,msgid,all,timeout)
ValueError: need more than 3 values to unpack

Hmm, this should never happen. I guess it's caused by _ldap.result3() returning NULL for the situation where no result was received at all. I will look into it.

In the meantime try if the patch to LDAPObject.py attached solves your problem.

Ciao, Michael.
Index: Lib/ldap/ldapobject.py
===================================================================
RCS file: /cvsroot/python-ldap/python-ldap/Lib/ldap/ldapobject.py,v
retrieving revision 1.98
diff -u -r1.98 ldapobject.py
--- Lib/ldap/ldapobject.py	5 Jun 2007 09:56:15 -0000	1.98
+++ Lib/ldap/ldapobject.py	29 Jan 2008 08:47:04 -0000
@@ -435,8 +435,12 @@
   def result3(self,msgid=_ldap.RES_ANY,all=1,timeout=None):
     if timeout is None:
       timeout = self.timeout
-    rtype, rdata, rmsgid, serverctrls = self._ldap_call(self._l.result3,msgid,all,timeout)
-    decoded_serverctrls = DecodeControlTuples(serverctrls)
+    ldap_result = self._ldap_call(self._l.result3,msgid,all,timeout)
+    if ldap_result is None:
+      rtype, rdata, rmsgid, decoded_serverctrls = (None,None,None,None)
+    else:
+      rtype, rdata, rmsgid, serverctrls = ldap_result
+      decoded_serverctrls = DecodeControlTuples(serverctrls)
     return rtype, rdata, rmsgid, decoded_serverctrls
  
   def search_ext(self,base,scope,filterstr='(objectClass=*)',attrlist=None,attrsonly=0,serverctrls=None,clientctrls=None,timeout=-1,sizelimit=0):
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Python-LDAP-dev mailing list
Python-LDAP-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/python-ldap-dev

Reply via email to