I think you want to do the sleep only if ldap_result[0] is None, otherwise you'll cause a sleep every loop, regardless if data is available or not. That's why I originally put it after the call to result() inside the polling loop. -- Leif