diff --git a/googleapiclient/http.py b/googleapiclient/http.py index 5b5ea159897..8f3dbcfc665 100644 --- a/googleapiclient/http.py +++ b/googleapiclient/http.py @@ -575,7 +575,10 @@ def __init__( ) def __del__(self): - self._fd.close() + try: + self._fd.close() + except AttributeError: + pass def to_json(self): """Creating a JSON representation of an instance of MediaFileUpload.