When I am trying to build a linux executable file it builds successfully but when i try to run the executable file it shows this error
Traceback (most recent call last):
File "pkgutil.py", line 637, in get_data
File "/home/user/.local/lib/python3.8/site-packages/PyInstaller/loader/pyimod03_importers.py", line 341, in get_data
with open(path, 'rb') as fp:
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/_MEI4f5JfX/grpc/_cython/_credentials/roots.pem'
Exception ignored in: 'grpc._cython.cygrpc.ssl_roots_override_callback'
Traceback (most recent call last):
File "pkgutil.py", line 637, in get_data
File "/home/user/.local/lib/python3.8/site-packages/PyInstaller/loader/pyimod03_importers.py", line 341, in get_data
with open(path, 'rb') as fp:
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/_MEI4f5JfX/grpc/_cython/_credentials/roots.pem'
E1122 03:58:17.060399901 23697 ssl_utils.cc:550] assertion failed: pem_root_certs != nullptr
Aborted (core dumped)
python file main.py
import firebase_admin
from firebase_admin import credentials
from firebase_admin import db, firestore
# firebase app setup
cred = credentials.Certificate({
"type": "service_account",
"project_id": "project-216t8",
........
....
..
})
firebase_admin.initialize_app(cred)
def fetch_data():
doc_ref = DocCollection_ref
docs= doc_ref.get()
if docs.exists:
docs = docs.to_dict()
print(f'Document data: {docs.to_dict()}')
else:
print(u'No such document!')
fetch_data()
This solution worked for me.
You will need to create a pyinstaller hook for packages that depend on setuptools' get_distribution() to obtain metadata information about the package.
Create a hook file in some hooks directory. The file name should be hook-<modulename>.py
for pyinstaller to find it properly (i.e. hook-gcloud.py
).
Solution : Create two hook files:
hook-gcloud.py
hook-grpc.py
In hook-gcloud.py write below code and save it :
from PyInstaller.utils.hooks import copy_metadata
datas = copy_metadata('gcloud')
In hook-grpc.py write below code and save it :
from PyInstaller.utils.hooks import collect_data_files
datas = collect_data_files ( 'grpc' )
Now copy and paste the both files to /lib/python3.8/site-packages/PyInstaller/hooks/ directory.