From 85ad8a44f87609c40eda308a1142b83f6f24be36 Mon Sep 17 00:00:00 2001 From: toby cabot Date: Fri, 17 May 2019 14:42:49 -0400 Subject: [PATCH] Don't use s3 bucket_head to check for bucket existence This is about https://github.com/RaRe-Technologies/smart_open/issues/314 This code caused problems when you have write permission to an s3 bucket path but not read permission to the bucket root. This code was added to prevent implicit bucket creation (to fix issue 154) but it appears that it is no longer needed. --- smart_open/s3.py | 8 -------- 1 file changed, 8 deletions(-) diff --git a/smart_open/s3.py b/smart_open/s3.py index 354c227b..a33b402e 100644 --- a/smart_open/s3.py +++ b/smart_open/s3.py @@ -418,14 +418,6 @@ def __init__( multipart_upload_kwargs = {} s3 = session.resource('s3', **resource_kwargs) - - # - # https://stackoverflow.com/questions/26871884/how-can-i-easily-determine-if-a-boto-3-s3-bucket-resource-exists - # - try: - s3.meta.client.head_bucket(Bucket=bucket) - except botocore.client.ClientError: - raise ValueError('the bucket %r does not exist, or is forbidden for access' % bucket) self._object = s3.Object(bucket, key) self._min_part_size = min_part_size self._mp = self._object.initiate_multipart_upload(**multipart_upload_kwargs)