Blankman Blankman - 1 year ago 174
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

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.