Reputation: 1
I am trying to upload a file in S3 bucket using below script
import os
import boto3
s3 = boto3.resource('s3')
data = open('help.jpg','rb')
print(data)
s3.buckets('Whoos_bucket').put_object(key='Whoos_bucket',Body=data)
And getting below error
s3.buckets('Whoos_bucket').put_object(key='Whoos_bucket',Body=data)
TypeError: 's3.bucketsCollectionManager' object is not callable
Please note that above bucket exists and I am able to list it as well
Upvotes: 0
Views: 756
Reputation: 52375
Why don't you check the documentation? What you are looking for is s3.Bucket
s3.Bucket('Whoos_bucket').put_object(key='Whoos_bucket',Body=data)
Upvotes: 2