я пытаюсь скопировать gzip-файл из одной корзины S3 и извлечь его содержимое в другую корзину S3 с помощью библиотеки gzip. я получаю сообщение об ошибке
Поиск с конца не поддерживается
import boto3, json
from io import BytesIO
import gzip
def lambda_handler():
try:
s3 = boto3.resource('s3')
copy_source = {
'Bucket': 'srcbucket',
'Key': 'samp.gz'
}
bucket = s3.Bucket('destbucket')
bucketSrc = s3.Bucket('srcbucket')
s3Client = boto3.client('s3', use_ssl=False)
s3Client.upload_fileobj( # upload a new obj to s3
Fileobj=gzip.GzipFile( # read in the output of gzip -d
None, # just return output as BytesIO
'rb', # read binary
fileobj=BytesIO(s3Client.get_object(Bucket='srcbucket', Key='samp.gz')['Body'].read())),
Bucket='destbucket', # target bucket, writing to
Key="") # target key, writing to
except Exception as e:
print(e)