I am trying to use PyDrive to get a list of all files in my Google Drive. I have read through the docs and completed all steps. I have client secrets.json saved down, but I cont
I too had all steps done as needed but was getting the same error. Then I added a debug print line inside PyDrive/clientsecrets.py -> _loadfile() to see the current working directory. Then noticed it was expecting the file relative to my Django app's URL pattern.
Eg: if this is how my Django URLs were defined for my app 'documents':
urlpatterns =
[
..
path('testGdrive/', views.testGdrive),
..
]
eg URL: /localhost:8000/documents/testGdrive/
If was expecting the file at 'documents/testGdrive/', whereas my JSON file was directly under the 'documents' folder('testGdrive' was a virtual folder)
Therefore, setting the full path solved this:
# don't start path with '/', as this causes it to look relative to the root folder
client_json_path = 'documents/client_secrets.json'
GoogleAuth.DEFAULT_SETTINGS['client_config_file'] = client_json_path