diff --git a/gslib/gcs_json_media.py b/gslib/gcs_json_media.py index 6746789285..1ed7fb2da3 100644 --- a/gslib/gcs_json_media.py +++ b/gslib/gcs_json_media.py @@ -583,7 +583,7 @@ def _conn_request(self, conn, request_uri, method, body, headers): # pylint: di raise except socket.error as e: err = 0 - if hasattr(e, 'args'): + if hasattr(e, 'args') and getattr(e, 'args'): err = getattr(e, 'args')[0] else: err = e.errno