Python-ldap set_option 不适用于优胜美地

2022-01-17 00:00:00 python ssl ldap python-ldap osx-yosemite

问题描述

我们已经成功安装了 python-ldap(2.4.19) 模块并成功执行了大部分操作.但是当我们尝试加载证书以使用 ssl (ldaps) 时,ldap.set_option 总是返回异常.

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).

它会出现在运行 Yosemite 的笔记本上,但不会出现在 Mavericks 或 Linux 上.(所有 Macbook 都安装了 xcode)

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.

有什么线索吗?

$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


解决方案

通过安装openldap throw brew,然后手动下载tarball,和mod setup.cfg 来选择/usr/local,然后安装.

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/ 是将/usr/local 添加到 python-ldap 上的默认值的票证.

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

相关文章