googlearchive/PyDrive

pydrive & shared drive - update existing file or trash/delete it

marchelloUA opened this issue · 2 comments

Hi,
I use pydrive Python library to upload files into my google drive using API and it works fine with "My Drive", including overwriting and deleting existing files.

It also works in "Shared drives" when I just upload files. The thing is that when I try to overwrite existing file with its ID or just trash/delete it, it just never works for me. I tried web UI just to make sure I have access rights and I'm able to trash it or overwrite (when I overwrite existing file, it shows suggestion "Keep as separate file" which I just ignore and it works). So, trash / delete just never happens and overwriting existing file with its id just creates another file with the same title.

Code example: https://pastebin.com/eC1RzCtu
Please advise what might be wrong.

@marchelloUA could you try to do the same with PyDrive2 (maintained version of this lib) - that's how we remove files in DVC - https://github.com/iterative/dvc/blob/40bdf613f0779aedee6298d6df5700ae10fa6d9c/dvc/tree/gdrive.py#L408 and it works for shared drives/as well as team drives as far as I know. If it doesn't feel free to create a ticket in the PyDrive2 issue tracker we will try to help. It would be great to have a small script that reproduces this.

@marchelloUA could you try to do the same with PyDrive2 (maintained version of this lib) - that's how we remove files in DVC - https://github.com/iterative/dvc/blob/40bdf613f0779aedee6298d6df5700ae10fa6d9c/dvc/tree/gdrive.py#L408 and it works for shared drives/as well as team drives as far as I know. If it doesn't feel free to create a ticket in the PyDrive2 issue tracker we will try to help. It would be great to have a small script that reproduces this.

Hey @shcheklein, this is just to let you know that deleting existing file from team drive works fine with PyDrive2. Thanks!