I am trying to execute the following program and facing this issue
botocore.exceptions.ClientError: An error occurred (404) when calling the HeadObject operation: Not Found
import boto3
s3 = boto3.resource('s3')
copy_source = {
'Bucket': 'forw',
'Key': 'test'
}
s3.meta.client.copy(copy_source,Bucket='copybucket0526',Key='tet')
Try this code it will work
import boto3
s3 = boto3.resource('s3')
copy_source = {
'Bucket': 'source_bucket',
'Key': 'dirname/subdirname/filename.gz'
}
s3.meta.client.copy(copy_source,Bucket='destination_bucket',Key='somedirname/new_or_same_filename.gz')
This is working I guess you are wrong in providing the path, means here you need to provide file complete path
通常 HeadObject 上的 404 代码意味着该资源不存在。
in the place of key make sure the you are taking care of parent folder or sub directories(if any) of the file you are going to copy from the source bucket.
copy_source = {
'Bucket': 'forw',
'Key': 'top_directory/sub_directory/file.jpg'
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.