In my program, I retrieve a value from a global variable if I run a program in the python console everything works, I defined the global variable as follows:
export GOOGLE_APPLICATION_CREDENTIALS = /home/pi/shared/service-account-file.json
The value is written in:
- /etc/profile
- /home/pi/.profile
However, I want the program to run periodically, using webmin I have added the program to run, but it always ends up loading errors in the global variable:
Traceback (most recent call last):
File "/home/pi/shared/CloudRaspberry.py", line 20, in <module>
db = firestore.Client()
File "/usr/local/lib/python3.7/dist-packages/google/cloud/firestore_v1/client.py", line 110, in __init__
project=project, credentials=credentials, _http=None
File "/usr/local/lib/python3.7/dist-packages/google/cloud/client.py", line 226, in __init__
_ClientProjectMixin.__init__(self, project=project)
File "/usr/local/lib/python3.7/dist-packages/google/cloud/client.py", line 178, in __init__
project = self._determine_default(project)
File "/usr/local/lib/python3.7/dist-packages/google/cloud/client.py", line 193, in _determine_default
return _determine_default_project(project)
File "/usr/local/lib/python3.7/dist-packages/google/cloud/_helpers.py", line 186, in _determine_default_project
_, project = google.auth.default()
File "/usr/local/lib/python3.7/dist-packages/google/auth/_default.py", line 321, in default
raise exceptions.DefaultCredentialsError(_HELP_MESSAGE)
google.auth.exceptions.DefaultCredentialsError: Could not automatically determine credentials. Please set GOOGLE_APPLICATION_CREDENTIALS or explicitly create credentials and re-run the application. For more information, please see https://cloud.google.com/docs/authentication/getting-started