Blankman Blankman - 2 years ago 258
Python Question

python s3 using boto, says 'attribute error: 'str' object has no attribute 'connection'

I have a connection that works as I can list buckets, but having issues when trying to add a object.

conn = S3Connection(awskey, awssecret)

key = Key(mybucket)

key.key = p.sku

I get the error:

'attribute error: 'str' object has no attribute 'connection'

the error is in the file:

/usr/local/lib/python2.6/dist-package/boto-2.obl-py2.6.egg/boto/s3/' line # 539

sth sth
Answer Source

Key expects a bucket object as its first parameter (possibly created by conn.create_bucket()).

It looks like mybucket isn't a bucket, but a string, so the call fails.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download