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
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)
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.