Larry Davis
Larry Davis

Reputation: 13

Application Default Credentials do not exist

I've been trying to use the Google Cloud Vision API to label and classify images, but I've been having a lot of trouble with credentials. I've set up credentials in the SDK and on the API manager itself, and I have set the GOOGLE_APPLICATION_CREDENTIALS environment variable, but the IDE I am running the code on still outputs:

ApplicationDefaultCredentialsError: File C:\Users\elden\Documents\Credentials\My First Project-6c0f3ccb6309 (pointed by GOOGLE_APPLICATION_CREDENTIALS environment variable) does not exist!

Here is the section of code that obtains the credentials:

credentials = gc.get_application_default()
service = build('vision', 'v1', credentials=credentials,discoveryServiceUrl=DISCOVERY_URL)

And here are the imports:

import argparse
import base64
import httplib2

from googleapiclient.discovery import build
from oauth2client.client import GoogleCredentials as gc

I'm running the code on Spyder 2.7.11 32-bit install on Windows 10.

The key is a generated JSON file.

Upvotes: 1

Views: 774

Answers (1)

Jeffrey Rennie
Jeffrey Rennie

Reputation: 3443

The file path needs to include the .json extension.

Upvotes: 1

Related Questions