Boto3: s3 resource has no attribute 'Object' in boto3 0.0.7

Created on 6 Feb 2015  路  4Comments  路  Source: boto/boto3

I just upgraded to boto3 0.0.7, and now I'm getting an error when trying to call s3.Object().

s3 = boto3.resource('s3')
obj = s3.Object('my-bucket', 'my-key')

That throws an AttributeError: "AttributeError: 's3' object has no attribute 'Object'"

If I go back to 0.0.6 or 0.0.5, I have no problems accessing s3.Object.

Was there a breaking change here? I didn't see anything in the release notes or changes in the docs.

documentation pending-release question

All 4 comments

@amattie sorry, the switch to the new resource JSON format (which is shared among AWS SDKs) includes a change in the organization of subresources. I will try to call out the change better in the changelog, and make sure the examples in the documentation are up to date. Here is the one and only way to get an S3 object now:

import boto3

s3 = boto3.resource('s3')
obj = s3.Bucket('my-bucket').Object('my-key')

@amattie I've added some clarification to the changelog and release notes about this. I have a question for you before I update the docs - do you prefer one style over the other?

I've created a pull request #60 to address this. We will be exposing the previous behavior again after some though on the subject. Version 0.0.8, when released, should address this issue.

This is now released in 0.0.8.

Was this page helpful?
0 / 5 - 0 ratings