PyDrive icon indicating copy to clipboard operation
PyDrive copied to clipboard

should close file after upload

Open zhigangc opened this issue 11 years ago • 6 comments

Even though the comment of SetContentFile mentions that the content will be closed in upload, but it does not happen.

zhigangc avatar Dec 06 '14 07:12 zhigangc

If you are still encountering this issue, please provide more information, and how to reproduce the issue.

RNabel avatar Jun 08 '16 03:06 RNabel

These can be safely ignored - python still closes the files and SSL sockets after using them. They were just not explicitly closed.

RNabel avatar Jun 09 '16 04:06 RNabel

I am having the same issue, where the file is not closed hence unable to remove it. Here is the problem I am having: https://stackoverflow.com/questions/60132814/pydrive-upload-and-remove?noredirect=1#comment106369915_60132814 how did you overcome it?

GaryLu889 avatar Feb 11 '20 21:02 GaryLu889

@GaryLu889 if you use file.SetContentFile(path) you can try to do file.content.close in the finally block. Please, let me know if that helps.

shcheklein avatar Feb 12 '20 07:02 shcheklein

@shcheklein Thank you so much, it works like a charm,

GaryLu889 avatar Feb 12 '20 11:02 GaryLu889

@GaryLu889 awesome! reopening this, since it can and should be handled on the PyDrive side.

shcheklein avatar Feb 12 '20 19:02 shcheklein