Python-ldap set_option not working on Yosemite

2019-04-06 13:02发布

问题:

We've installed the python-ldap(2.4.19) module without errors and perform most of the operations successfully. However ldap.set_option always returns a exception when we try to load certificates to use ssl (ldaps).

It occurs on notebooks running Yosemite but not on Mavericks or Linux. (All Macbooks have xcode installed)

We think it should be some missing/outdated/updated lib but we don't know how to find it.

Any clues?

$python
Python 2.7.6 (default, Sep  9 2014, 15:04:36)
...
>>>import ldap
>>>ldap.set_option(ldap.OPT_X_TLS_CACERTFILE, '/my_path/my_cert.crt')
Traceback (most recent call last):
 File "<stdin>", line 1, in <module>
 File "/*xxx*/python2.7/site-packages/ldap/functions.py", line 133, in set_option
   return _ldap_function_call(None,_ldap.set_option,option,invalue)
 File "/*xxx*/python2.7/site-packages/ldap/functions.py", line 64, in _ldap_function_call
   result = func(*args,**kwargs)
ValueError: option error

回答1:

got around this by installing openldap threw brew, and then manually downloading the tarball, and mod setup.cfg to pick up /usr/local, and then install.

http://sourceforge.net/p/python-ldap/bugs/65/ is the ticket to add /usr/local to the defaults on python-ldap.