[Tutor] python ssl error

Danny Yoo dyoo at hashcollision.org
Mon Aug 18 00:26:06 CEST 2014


On Sun, Aug 17, 2014 at 5:14 AM, Matthew Ngaha <chigga101 at gmail.com> wrote:
> Hi this might not be the correct place to ask this. I am using the
> google api and as soon as I use the build function:
>
>     service = build('books', 'v1', developerKey=api_key)
>
> I get an SSL error. I'm not sure what build() does but it triggers an
> SSL error. Here's the error message:
>
>      ssl.SSLError: [Errno 185090050] _ssl.c:357: error:0B084002:x509
> certificate routines:X509_load_cert_crl_file:system lib


Hi Matthew,

Yeah, this is not quite Python-Tutor material.  Check with the
httplib2 folks: I think this in is their domain.

Anyway, thanks for the detailed error message.  It gives me something
to search.  I'll see if there's something reasonable here...

... ok, found something.  According to:

    http://stackoverflow.com/questions/15696526/ssl-throwing-error-185090050-while-authentication-via-oauth

the httplib2 library is having trouble accessing the certificate file.
This appears a bug involved with the pip installer and root
permissions:

    https://code.google.com/p/httplib2/issues/detail?id=292


In your case, since your httplib2 is installed in:

    /usr/lib/python2.7/site-packages/httplib2-0.9-py2.7.egg/httplib2/

I would recommend checking whether the 'cacerts.txt' file in that
subdirectory is user-readable or not.  Make sure it's readable.  If it
isn't, chmod it and try again: that will probably fix it.


If you do a few more searches, you might run into two dubious recommendations:

   1.  Run as root.
   2.  Disable ssl certficiate validation.

Both of these recommendations look potentially dangerous to me.  Don't
do either of these unless you really know what you're doing.

At the very least, you might try #1 just to see if you see the same
error message: if you do not see that error message when running as
the superuser, then that almost certainly means that the cause is
permission access to the cacerts.txt file.  The fix, then, should be:
correct the permission of that file.  Try not to run programs as
superuser if you can help it.


More information about the Tutor mailing list