I try to upload a zip file to my S3 bucket, but getting
AttributeError: у объекта 'ZipFile' нет атрибута 'скажите' ошибка
conn = boto.s3.connect_to_region(region_name=s3region,
aws_access_key_id=userid,
aws_secret_access_key=accesskey,
calling_format=boto.s3.connection.OrdinaryCallingFormat())
bucket = conn.get_bucket(s3bucket)
k = boto.s3.key.Key(bucket, zipf)
k.send_file(zipf) //<----Gives Exception
Что здесь не так? (zipf - это мой zipfile)
если я изменю код следующим образом;
with open(zipf) as f:
k.send_file(f)
Я получаю
TypeError: приведение к Unicode: нужна строка или буфер, найден ZipFile
Я создал zip-файл как;
zipfilename = 'AAA_' + str(datetime.datetime.utcnow().replace(microsecond=0)) + '.zip'
zipf = zipfile.ZipFile(zipfilename, mode='w')
for root, dirs, files in os.walk(path):
for f in files:
zipf.write(os.path.join(root, f))
zipf.close()