下面的代码使用python2.7
从AWS S3存储桶下载文件。我想显示一个进度条。
#! usr/bin/python
import boto3
import botocore
file1 = open("aws.txt","r")
r1 = file1.read()
length = len(r1)-1
file1.close()
file2 = open("aws.txt","r")
r2 = file2.read(length)
file2.close
s3 = boto3.resource('s3')
try:
s3.Bucket('gustotest2').download_file(r2,r2)
except botocore.exception.ClientErrors as e:
if e.response['Error']['Code'] == '404':
print('The update file does not exist')
else:
raise
有人可以为此建议我一个解决方案吗? 预先感谢!