i’ve got some python code that’s successfully running on my windows machine in the python ide and cmd prompt.
after i compile with pyinstaller (into one file) i get the following error:
Traceback <most recent call last>:
File "<string>", line 51, in <module>
File "build\bdist.win32\egg\oauth2\__init__.py", line 682, in request
... ((traceback through httplib2 and then ssl))
ssl.SSLError: [Errno 185090050] _ssl.c:340: error:0B084002:x509 certificates routines:X509_load_cert_crl_file:system lib
a subset of my code that’s causing the error is as follows:
import oauth2 as oauth
import httplib2
import urlparse
#consumer inputs
consumer_key = 'blah'
consumer_secret = 'blah'
consumer = oauth.Consumer(consumer_key, consumer_secret)
#other inputs
request_token_url = 'https://api.linkedin.com/uas/oauth/requestToken?scope=r_network'
access_token_url = 'https://api.linkedin.com/uas/oauth/accessToken'
authorize_url = 'https://api.linkedin.com/uas/oauth/authorize'
#instantiate consumer object
client = oauth.Client(consumer)
resp, content = client.request(request_token_url, "POST", )
should be a simple api request! i’ve look all over and tried to use the following at the beginning of the code:
httplib2.Http(ca_certs = 'cacert.pem')
…that didn’t work.
i’ve also replaced my cacerts.txt file in httplib2 folder with the new cacert.pem (renamed to cacerts.txt)… but that didn’t work.
i’ve tried to disable ssl with this:
httplib2.Http(disable_ssl_certificate_validation=True)
…but that didn’t work.
How do I compile my python script using pyinstaller in a way that doesn’t mess up?
I had the same problem when I tried to connect to google drive with OAuth 2.0. I have searched and found that the solution is changing in httplib2 in init.py this line
by this other
then build the .exe and put the “cacerts.txt” file in the same folder of the .exe.
It worked for me, I hope it does for you too!