Issue with file closing in MediaFileUpload #2489
Labels
priority: p2
Moderately-important priority. Fix may not be included in next release.
type: bug
Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
When using the MediaFileUpload class to upload files to Google Drive via google-api-python-client, the file remains open after the upload completes, resulting in a PermissionError when I attempt to delete the file.
Code example:
Expected behavior: The file should automatically close after uploading so that it can be deleted without errors.
Actual behavior: The file remains open, and attempting to delete it results in a PermissionError.
Solution: I resolved the issue manually by adding media._fd.close() after the upload completes to close the file.
The text was updated successfully, but these errors were encountered: