From 21067c3b9ed3f6e81c1690fbcc56187b4333fb7d Mon Sep 17 00:00:00 2001 From: Alessandro Date: Thu, 13 Sep 2018 23:52:37 +0200 Subject: [PATCH] Added a try except block at the end of the Upload() method, trying to close the file. If it's not a file, discard the error. --- pydrive/files.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pydrive/files.py b/pydrive/files.py index 1d40304..5ddfc9f 100644 --- a/pydrive/files.py +++ b/pydrive/files.py @@ -292,6 +292,10 @@ def Upload(self, param=None): self._FilesPatch(param=param) else: self._FilesInsert(param=param) + try: + self.content.close() + except AttributeError: + pass def Trash(self, param=None): """Move a file to the trash.