Wilson Cordeiro
Wilson Cordeiro

Reputation: 11

Exception in GRPC when trying to execute Google Cloud API

I am having a problem when I generate an exe file with pyinstaller. My code runs okay when I execute using the python interpreter but when I generate the exe file using the PyInstaller I get a GRPC error.

Error: Exception in 'grpc._cython.cygrpc.ssl_roots_override_callback' ignored E0807 20:38:36.262000000 10808 src/core/lib/security/security_connector/security_connector.cc:1173] assertion failed: pem_root_certs != nullptr

The error happen when I try to execute a long_running_recognize.

Any tips regarding this problem?

Upvotes: 1

Views: 2359

Answers (3)

swapnil gaikwad
swapnil gaikwad

Reputation: 21

To resolve this I did the following

1.) create a hook-grpc with the following code

from PyInstaller.utils.hooks import collect_data_files datas = collect_data_files('grpc')

2.) saved this file the location C:\Users\swap***\AppData\Local\Programs\Python\Python39\Lib\site-packages\PyInstaller\hooks (this will vary as per the installation)

3.) Re create the exe file using the PyInstaller command to create the file is below

pyinstaller --onefile pythonScriptName.py (replace this"pythonScriptName" with your file name)

Upvotes: 1

Mirza Cosic
Mirza Cosic

Reputation: 41

Create hook-grpc.py in the hooks folder (\Lib\site - packages\PyInstaller\hooks) and put the following code.

from PyInstaller.utils.hooks import collect_data_files

datas = collect_data_files ( 'grpc' )

If this doesn't work, then go to \Lib\site - packages\PyInstaller\hooks and add the following code to hook-google.cloud.py file.

datas += copy_metadata ( 'google-cloud-firestore' )

Upvotes: 4

Juanli Shen
Juanli Shen

Reputation: 56

https://github.com/grpc/grpc/issues/9223 looks similar with this issue.

Upvotes: 0

Related Questions