Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/oauth2client/clientsecrets.py", line 86, in _validate_clientsecrets
(client_type, client_info), = clientsecrets_dict.items()
ValueError: too many values to unpack (expected 1)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/Myusername/Projects/Python projects/google sheets test/test that baby action.py", line 3, in <module>
gc = pygsheets.authorize(outh_file='/Users/Myusername/Projects/Python projects/google sheets test/client_secret.json')
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pygsheets/client.py", line 596, in authorize
outh_nonlocal=outh_nonlocal)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pygsheets/client.py", line 555, in get_outh_credentials
flow = client.flow_from_clientsecrets(client_secret_file, SCOPES)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/oauth2client/_helpers.py", line 133, in positional_wrapper
return wrapped(*args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/oauth2client/client.py", line 2135, in flow_from_clientsecrets
cache=cache)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/oauth2client/clientsecrets.py", line 165, in loadfile
return _loadfile(filename)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/oauth2client/clientsecrets.py", line 126, in _loadfile
return _validate_clientsecrets(obj)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/oauth2client/clientsecrets.py", line 89, in _validate_clientsecrets
_INVALID_FILE_FORMAT_MSG + ' '
oauth2client.clientsecrets.InvalidClientSecretsError: Invalid file format. See https://developers.google.com/api-client-library/python/guide/aaa_client_secrets Expected a JSON object with a single property for a "web" or "installed" application
The Google Sheets and Drive APIs are both enabled on my Google Developers Console.
I renamed json file to client_secret.json and put it in the folder for this project. I'm using the full path to it in the pygsheets.authorize function to be extra-sure I'm doing this right. And I didn't edit anything within the json file.
One thing I will say about the json file… On some other tutorial I read, their json file examples weren't formatted like mine—they had "web": or "installed": at the top of them.
Help? I feel like this could be user error as I'm very new to Python and thus this library as well… But at the same time, I am following the documentation's directions precisely. Or, could this be a problem with oauth2client…?
I have an error message when trying to authorize. My code is just the following so far:
Which returns the error:
And, here's the json in case you were wondering:
To be clear,
pygsheets.authorize
function to be extra-sure I'm doing this right. And I didn't edit anything within the json file.One thing I will say about the json file… On some other tutorial I read, their json file examples weren't formatted like mine—they had
"web":
or"installed":
at the top of them.Help? I feel like this could be user error as I'm very new to Python and thus this library as well… But at the same time, I am following the documentation's directions precisely. Or, could this be a problem with oauth2client…?
Thanks! Will appreciate any help.