EmpathyBot - Google Application Default Credentials not available


#1

Hello, I have tried creating a JSON Key for Google Cloud Vision to finish up the Empathybot but I am having a problem. The JSON Key was created on Windows and transferred to my Raspberry Pi 3 using a USB and placed in /home/pi/ I did this q few times and even renamed it.

The BASHRC file was edited to reflect on this, and the export commend was used before attempting to execute the python file but to no avail. An output is as below:

pi@raspberrypi:~/Desktop export GOOGLE_APPLICATION_CREDENTIALS=vision1-f456725196de.json pi@raspberrypi:~/Desktop sudo python empathy.py
espeak -ven-us+f3 -a 200 -s145 -k20 --stdout ‘Hello! I am empathy bot!’ | aplay
Playing WAVE ‘stdin’ : Signed 16 bit Little Endian, Rate 22050 Hz, Mono
espeak -ven-us+f3 -a 200 -s145 -k20 --stdout ‘I am ready to empathize!’ | aplay
Playing WAVE ‘stdin’ : Signed 16 bit Little Endian, Rate 22050 Hz, Mono
TAKE PICTURE: image2017-06-25092611.933790.jpg
image2017-06-25092611.933790.jpg
Traceback (most recent call last):
File “empathy.py”, line 196, in
main()
File “empathy.py”, line 191, in main
take_emotion()
File “empathy.py”, line 120, in take_emotion
credentials = GoogleCredentials.get_application_default()
File “/usr/local/lib/python2.7/dist-packages/oauth2client/client.py”, line 1271, in get_application_default
return GoogleCredentials._get_implicit_credentials()
File “/usr/local/lib/python2.7/dist-packages/oauth2client/client.py”, line 1261, in _get_implicit_credentials
raise ApplicationDefaultCredentialsError(ADC_HELP_MSG)
oauth2client.client.ApplicationDefaultCredentialsError: The Application Default Credentials are not available. They are available if running in Google Compute Engine. Otherwise, the environment variable GOOGLE_APPLICATION_CREDENTIALS must be defined pointing to a file defining the credentials. See https://developers.google.com/accounts/docs/application-default-credentials for more information.
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
File “/usr/lib/python2.7/atexit.py”, line 24, in _run_exitfuncs
func(*targs, **kargs)
TypeError: ‘NoneType’ object is not callable
Error in sys.exitfunc:
Traceback (most recent call last):
File “/usr/lib/python2.7/atexit.py”, line 24, in _run_exitfuncs
func(*targs, **kargs)
TypeError: ‘NoneType’ object is not callable


#2

I suspect the problem might be with the user permissions. I would try to go into super user by running su in the command line and then running

export GOOGLE_APPLICATION_CREDENTIALS=vision1-f456725196de.json

You can also try running

sudo export GOOGLE_APPLICATION_CREDENTIALS=vision1-f456725196de.json


#3

Tried that but didn’t work. Same error message. Any other suggestions?


#4

Are you doing all of this in the same directory? The python file, the json file, and the export action?