[python-ldap] ValueError: option error on trying to set OPT_X_TLS_CACERTFILE
Peter Bengtsson
pbengtsson at mozilla.com
Sat Feb 6 13:53:54 EST 2016
Sending this again. Hopefully, when subscribed to the mailing list
correctly this time.
On Fri, Feb 5, 2016 at 9:00 AM, Peter Bengtsson <pbengtsson at mozilla.com>
wrote:
>
>
> On Fri, Feb 5, 2016 at 2:14 AM, Michael Ströder <michael at stroeder.com>
> wrote:
>
>> Peter Bengtsson wrote:
>> > I'm on OSX 10.11.3 and I installed python-ldap 2.4.25 with pip in a
>> > virtualenv. And I always get this error:
>> >
>> >>>> import ldap
>> >>>> ldap.set_option(ldap.OPT_X_TLS_CACERTFILE, '/path/to.crt')
>> > Traceback (most recent call last):
>> > File "<stdin>", line 1, in <module>
>> > File
>> >
>> "/Users/peterbe/virtualenvs/medlem/lib/python2.7/site-packages/python_ldap-2.4.25-py2.7-macosx-10.11-x86_64.egg/ldap/functions.py",
>> > line 133, in set_option
>> > return _ldap_function_call(None,_ldap.set_option,option,invalue)
>> > File
>> >
>> "/Users/peterbe/virtualenvs/medlem/lib/python2.7/site-packages/python_ldap-2.4.25-py2.7-macosx-10.11-x86_64.egg/ldap/functions.py",
>> > line 64, in _ldap_function_call
>> > result = func(*args,**kwargs)
>> > ValueError: option error
>>
>> Most times this happens if the cert file does not exist.
>>
>>
> Wouldn't/Shouldn't that yield a IOError then if it tries to read a file
> that doesn't exist?
>
> Either way, see:
>
> (medlem) :~/dev/MOZILLA/MEDLEM/ldap-bind/medlem$ ls -l
> total 40
> -rw-r--r-- 1 peterbe staff 64 Feb 4 11:48 bind_credentials.txt
> -rw-r--r-- 1 peterbe staff 4676 Feb 4 11:46 ldapproxy-medlem.crt
> -rw-r--r-- 1 peterbe staff 1188 Feb 4 11:46 ldapproxy-medlem.csr
> -rw-r--r-- 1 peterbe staff 1675 Feb 4 11:46 ldapproxy-medlem.key
>
> (medlem) :~/dev/MOZILLA/MEDLEM/ldap-bind/medlem$ python
> Python 2.7.11 (default, Jan 20 2016, 12:30:21)
> [GCC 4.2.1 Compatible Apple LLVM 7.0.2 (clang-700.1.81)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import os
> >>> assert os.path.isfile('ldapproxy-medlem.crt')
> >>> import ldap
> >>> ldap.set_option(ldap.OPT_X_TLS_CACERTFILE, 'ldapproxy-medlem.crt')
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> File
> "/Users/peterbe/virtualenvs/medlem/lib/python2.7/site-packages/python_ldap-2.4.25-py2.7-macosx-10.11-x86_64.egg/ldap/functions.py",
> line 133, in set_option
> return _ldap_function_call(None,_ldap.set_option,option,invalue)
> File
> "/Users/peterbe/virtualenvs/medlem/lib/python2.7/site-packages/python_ldap-2.4.25-py2.7-macosx-10.11-x86_64.egg/ldap/functions.py",
> line 64, in _ldap_function_call
> result = func(*args,**kwargs)
> ValueError: option error
> >>>
>
>
> The file clearly exists.
>
>
>> > It doesn't matter what the value of that option is.
>> > It does not happen when installed on Ubuntu.
>>
>> Hmm.
>>
>> > Axel here, http://stackoverflow.com/a/29101851/205832 said he managed
>> to
>> > make the problem go away by downloading the tarball and adding
>> /usr/local
>> > to setup.cfg. That did not help for me.
>>
>> That sounds like a strange solution to me. But I have no personal
>> experience
>> with with Max OS X.
>>
>> Ciao, Michael.
>>
>> P.S.: Please subscribe to the low-traffic python-ldap mailing list. So
>> all the
>> answers really reach you.
>>
>>
> I am subscribed.
>
>
> --
> Peter Bengtsson
> Mozilla Tools & Services
>
--
Peter Bengtsson
Mozilla Tools & Services
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ldap/attachments/20160206/cf954ae5/attachment.html>
More information about the python-ldap
mailing list