PyDrive icon indicating copy to clipboard operation
PyDrive copied to clipboard

ListFile returns empty?

Open harishaaram opened this issue 6 years ago • 14 comments

Hi,

I am trying find the id and title of files and folder inside my google drive, so i am using ListFile(). However I am getting empty list( but I can use CreateFile(), Upload() etc to get upload new files). Here is the code,

file_list = drive.ListFile({'q': "'root' in parents and trashed=false"}).GetList() for file1 in file_list: print('title: %s, id: %s' % (file1['title'], file1['id']))

What should I do to resolve this issue?

harishaaram avatar Nov 06 '17 18:11 harishaaram

Are you using automatic authentication?

MateoWartelle avatar Dec 09 '17 22:12 MateoWartelle

I'm having same issue. @MateoWartelle, yes I'm using automatic authentication

donjajo avatar Feb 09 '18 07:02 donjajo

Confirm the same bug. Using automatic auth. Work without automatic auth. CreateFile() and Upload() work well. PyDrive==1.3.1

lkrcal avatar Feb 11 '18 05:02 lkrcal

I also encounter the same problem with automatic auth. As Ikrcal says, CreateFile() and Upload() work well for me also.

n-loureiro avatar Feb 13 '18 17:02 n-loureiro

Same here, it seems to list only the files created by the current app, even when not using automatic OAuth

melMass avatar Feb 14 '18 13:02 melMass

I have the same bug

kurt-rhee avatar Mar 19 '18 21:03 kurt-rhee

I have the same bug.

Most files return file info, always. but, some file couldn't return file info, always....

marreta27 avatar Aug 27 '18 11:08 marreta27

Same here, it seems to list only the files created by the current app, even when not using automatic OAuth Same here, is this by design or it's a bug?

kevenv avatar Sep 22 '18 18:09 kevenv

Any updates to this? I'm also getting an empty list when using FileList.

alexanfl avatar Jul 11 '19 13:07 alexanfl

Same problem here using automated authentication via the settings.yaml, verified to work as expected when using the LocalWebserverAuth(). I ended up working around this by using a service account and then sharing a specific folder.

bazeli avatar Oct 09 '19 00:10 bazeli

Ill revisit and open a PR

MateoWartelle avatar Oct 09 '19 03:10 MateoWartelle

Ill revisit and open a PR

Hello @MateoWartelle, can you please provide the link to the PR please ?

thank you very much !

VinceD2049 avatar Jan 21 '20 14:01 VinceD2049

I just had the same issue. When playing around, I had created a settings.yaml by copying the sample one here: https://pythonhosted.org/PyDrive/oauth.html#sample-settings-yaml

I noticed that when granting permissions in the Google auth page, it said something along the lines of This application requests permission to create/delete/list files created by the app, which explains why it wouldn't be able to see files not created by the app.

Removing the oauth_scope: entry from the sample settings (So it just uses the default https://www.googleapis.com/auth/drive solved the issue for me (which grants it permission for everything).

Panaetius avatar Feb 21 '20 08:02 Panaetius

I just had the same issue. When playing around, I had created a settings.yaml by copying the sample one here: https://pythonhosted.org/PyDrive/oauth.html#sample-settings-yaml

I noticed that when granting permissions in the Google auth page, it said something along the lines of This application requests permission to create/delete/list files created by the app, which explains why it wouldn't be able to see files not created by the app.

Removing the oauth_scope: entry from the sample settings (So it just uses the default https://www.googleapis.com/auth/drive solved the issue for me (which grants it permission for everything).

This worked for me, I use automatic authentication. For it to work you'd have to delete your credentials.json file and run the authentication code again

Mcsavvy avatar Nov 20 '20 14:11 Mcsavvy