You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
quickstart.py credentials.json not found for read #211
File "/hd2/projects/temp/python-samples/gmail/quickstart/quickstart.py", line 62, in
main()
File "/hd2/projects/temp/python-samples/gmail/quickstart/quickstart.py", line 41, in main
flow = InstalledAppFlow.from_client_secrets_file(
File "/home/stephen/.local/lib/python3.9/site-packages/google_auth_oauthlib/flow.py", line 180, in from_client_secrets_file
with open(client_secrets_file, 'r') as json_file:
FileNotFoundError: [Errno 2] No such file or directory: 'credentials.json'
Click the download button to the right of the newly-created OAuth 2.0 Client ID. This copies a client secret JSON file to your desktop
This is the file they are referring as "credentials.json". Copy this client secret file to your proper location, rename it to "credentials.json" and of course, give it the read permissions.
For anyone else having this issue who did follow the instructions to a T (except for one part)...
My issue was that I was trying to run quickstart.py from within VS Code (with venv active). Why can't this work? Hell if I know. But when ran the file in terminal --> python quickstart.py (after activating the same venv), it worked.
For the record, I did not have to change any permissions on the json file. It came with read permissions.
Activity
Nadesri commentedon Jul 21, 2021
I had the same error but found I was just not reading carefully enough; based on your repro steps it's possible you ran into the same thing.
The README.md is a bit confusing about this, but you need to follow the Prerequisites in the Python Quickstart page first: https://developers.google.com/gmail/api/quickstart/python#prerequisites
Note the following requirements in particular:
YoelMonsalve commentedon Jul 28, 2021
I had the same issue, and it's kind of silly (just had to read carefully). Create a credential for your desktop application (as it's based on Python) as described by Nadersi: https://developers.google.com/workspace/guides/create-credentials
Then, download the client secret JSON file: https://developers.google.com/workspace/guides/create-credentials#desktop
Note, when it says:
This is the file they are referring as "credentials.json". Copy this client secret file to your proper location, rename it to "credentials.json" and of course, give it the read permissions.
its-all-waves commentedon Nov 6, 2022
For anyone else having this issue who did follow the instructions to a T (except for one part)...
My issue was that I was trying to run quickstart.py from within VS Code (with venv active). Why can't this work? Hell if I know. But when ran the file in terminal -->
python quickstart.py(after activating the same venv), it worked.For the record, I did not have to change any permissions on the json file. It came with read permissions.