Warm tip: This article is reproduced from serverfault.com, please click

S3 giving me NoSuchKey error even when the key exists

发布于 2017-06-27 10:51:31

This is my boto3 command for getting the object with a specific key from an S3 bucket:

resp = s3client.get_object(Bucket='<>-<>', Key='MzA1MjY1NzkzX2QudHh0')

It gives the following error:

botocore.errorfactory.NoSuchKey: An error occurred (NoSuchKey) when calling the GetObject operation: The specified key does not exist.

I have checked in the bucket, and the key actually exists

enter image description here

Did I miss something or did I do something wrong here?

Questioner
Dawny33
Viewed
0
Chris Pollard 2017-06-27 19:20:23

You have a %0A at the end of your URL; that's a line separator.