Errno 185090050 _ssl.c: 343: error: 0B084002: x509 verification procedures: X509_load_cert_crl_file: system lib, after packaging in exe from PyInstaller

I am coding a python script to check files in GCS, it uses wxpython to generate a GUI. For authentication, I did it this way (following the sample Google code → http://code.google.com/p/google-cloud-platform-samples/source/browse/file-transfer-json/chunked_transfer.py?repo= storage ):

flow = flow_from_clientsecrets(CLIENT_SECRETS_FILE, # the secrets file I put in same folder scope=scope, message=MISSING_CLIENT_SECRETS_MESSAGE) credential_storage = CredentialStorage(CREDENTIALS_FILE) # the file to store # authentication credentials credentials = credential_storage.get() if credentials is None or credentials.invalid: credentials = run_oauth2(flow, credential_storage) self.printLog('Constructing Google Cloud Storage service...') http = credentials.authorize(httplib2.Http()) return discovery_build('storage', 'v1beta1', http=http) 

The codes above are contained in my Python script, which works very well when it is just a python.py file, later I used pyinstaller to convert it to .exe in win 7 64bit (I also put the secret file in the same folder as .exe file) using the command

C: \ gcs_file_check> python pyinstaller-2.0 \ pyinstaller.py -w gcs_file_check.py

When you clicked on exe, the Permission Request page from Google was launched correctly (how it works with running the Python script not exe), but after clicking the "Accept" button, the above code will throw an exception:

[Errno 185090050] _ssl.c: 343: error: 0B084002: x509 certificate routine: X509_load_cert_crl_file: system lib

And I can see that the credentials.json file was not created by .exe, and the Python script can correctly create this file.

Can anyone find out how this happens and how to fix it? Appreciate every answer!

=====================

updated 04/16:

I added the debugging code and found that the exception comes from the code below:

 if credentials is None or credentials.invalid: credentials = run_oauth2(flow, credential_storage) 

=====================

update:

Add more details, I previously used oauth2client.tools.run ()

 from oauth2client.tools import run as run_oauth2 

Now I go to run_flow () as the source code -> https://google-api-python-client.googlecode.com/hg/docs/epy/oauth2client.tools-pysrc.html#run

 from oauth2client.tools import run_flow as run_oauth2 

Now this piece of code:

 parser=argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter, parents=[tools.argparser] ) flags = tools.argparser.parse_args(sys.argv[1:]) if credentials is None or credentials.invalid: credentials = run_oauth2(flow, credential_storage, flags) 

But still , python code works well and throws the same exception [Errno 185090050] after packing into .exe from PyInstaller.

+4
source share
1 answer

try this, https://github.com/kennethreitz/requests/issues/557 "I also encountered a similar error when using pyinstaller with Httplib2. You need to explicitly pass the path to the ssl client certificate file to the http request for the cert argument. Also , you will need to pack your ..pem as a data file in pyinstaller. "

+1
source

Source: https://habr.com/ru/post/972891/


All Articles