PyDrive2
PyDrive2 copied to clipboard
Rename google file title
When I rename the title of a file, I have to do following:
googlefile = drive.CreateFile({"id": file_id})
googlefile.FetchMetadata(fields="title")
googlefile["title"] = new_title
googlefile.Upload()
Not like the example, I need to add:
googlefile.FetchMetadata(fields="title")
@hagemouse could you please try the PyDrive (the old one repo)? I wonder if it is a regression of some sort?
Just gave me following:
pydrive.files.ApiRequestError: <HttpError 404 when requesting https://www.googleapis.com/drive/v2/files/vx5FvnY2qrRJpGNhmRg?fields=title&alt=json returned "File not found"
Even if i tried this:
file =drive.CreateFile({"id":file_id,
'corpora': "teamDrive",
'teamDriveId': dirve_id,
'includeTeamDriveItems': "true",
'includeItemsFromAllDrives': "true",
'supportsTeamDrives': "true",
'supportsAllDrives': "true"})
file.FetchMetadata(fields="title") #here 404 happened
file["title"]= new_title
file.Upload()
@hagemouse could you try the same with a regular, your own drive, to avoid dealing with team and shared drives? (to avoid 404)
I tried it using pydrive on my own drive, and also need to add following:
file.FetchMetadata(fields="title")
@hagemouse thanks! it helps. It's not a regression then. I found the code that is responsible for this. Now we need to understand if it's a bug of should we just fix the example.
Related https://github.com/googleworkspace/PyDrive/issues/101
Ok. Thanks.