I am trying to delete a specific .jpg file from an s3 bucket. I have tried numerous different methods such as delete_object and several other stack overflow answers. None of them have worked properly and result in the program crashing with differing exit codes each time. The code below doesn't crash the program but the bucket remains unchanged. Does anyone know how to fix this?
s3 = boto3.resource('s3')
s3.Object('my-bucket', 'label_file').delete()
When printing the response of the call, this is the message printed to the terminal.
{
'ResponseMetadata': {
'RequestId': 'FJEOSIJFIO2J31',
'HostId': 'VEt+tpQ+DSAW5UTx/+kGgmE0JX43345lX2ULHMDSDrKye1PsTA3Eo=',
'HTTPStatusCode': 314,
'HTTPHeaders': {
'x-amz-id-2': 'VEt+tpQo2DAS6z+m8o3215UTx/+kGgmE0JX2DSi3ULHMDrKyevPsTA3Eo=',
'x-amz-request-id': 'T255WdZ732sVDWJF',
'date': 'Wed, 07 Apr 2021 19:28:04 GMT',
'x-amz-version-id': '4gi8EtDS27ZNy221tkziO',
'x-amz-delete-marker': 'true',
'server': 'AmazonS3'
},
'RetryAttempts': 0
},
'DeleteMarker': True,
'VersionId': '4gioU7FD36t5hcX21IOtkziO'
}