InvalidClientSecretsError: File not found: "client_secret.json"

1,606 views
Skip to first unread message

WBascus

unread,
Oct 21, 2015, 8:04:25 PM10/21/15
to Google API Python Client
I'm trying to follow the Python Quickstart for the Google Calendar API.  It worked great for reading events, but when I went to insert events, I ran into an error that I thought I could resolve by deleting my client_secret.json file.  

Now, any attempt to use oauth2 for authentication results in the following python errors:   

Traceback (most recent call last):

  File "/~/documents/test_project/quickstart.py", line 76, in <module>

    main()

  File "/~/documents/test_project/quickstart.py", line 57, in main

    credentials = get_credentials()

  File "/~/documents/test_project/quickstart.py", line 42, in get_credentials

    flow = client.flow_from_clientsecrets(CLIENT_SECRET_FILE, SCOPES)

  File "/usr/local/lib/python2.7/site-packages/oauth2client/util.py", line 142, in positional_wrapper

    return wrapped(*args, **kwargs)

  File "/usr/local/lib/python2.7/site-packages/oauth2client/client.py", line 2210, in flow_from_clientsecrets

    cache=cache)

  File "/usr/local/lib/python2.7/site-packages/oauth2client/clientsecrets.py", line 165, in loadfile

    return _loadfile(filename)

  File "/usr/local/lib/python2.7/site-packages/oauth2client/clientsecrets.py", line 125, in _loadfile

    raise InvalidClientSecretsError('File not found: "%s"' % filename)

oauth2client.clientsecrets.InvalidClientSecretsError: File not found: "client_secret.json"


I have tried:

  • regenerating and resaving my client_secret.json file
  • uninstalling and reinstalling the oauth2 python package
  • uninstalling and reinstalling the google-api python package
  • starting a new Google developer project with entirely new credentials, and starting an entirely new project working directory
  • hard-coding the CLIENT_SECRET_FILE into the client.flow_from_clientsecrets() call 
Working through /client and /clientsecret seemed to make sense, and everything indicates that for some reason, they don't think that there's a client secret file in the working directory, even though I keep regenerating it.   

There's also a cache element, and frankly, I can't find the proper documentation for directing get_credentials() to not use a cache.   

Any help appreciated.


Daiske Barrett

unread,
Jan 27, 2016, 4:53:37 PM1/27/16
to Google API Python Client, william...@gmail.com
Hi there, this driving me nuts for a long time. Although I downloaded client_secret.json file under my .credentials directory python was unable to locate file. I checked for permission but all was ok.

I was able running the script when i put client_secret.json in the same script directoy
Reply all
Reply to author
Forward
0 new messages