for b in rs:
if b.name == n:
...
else:
print "That bucket does not exist!"
exit(0)
This seems to assume there's only one bucket on the account. If there's more than one bucket, it's a crapshoot whether this code will work correctly: Maybe the bucket zapbucketx
will be returned first, maybe it won't.
Seems like what you really want is
else:
continue
So that the loop will continue through the list of buckets until it finds zapbucketx.
Also, this line is wrong:
conn.delete_bucket('n')
You want conn.delete_bucket(n)
.
You probably also want an exit after the delete_bucket
call, or the loop will continue to the next bucket-name and then complain about bucket-doesn't-exist.
Also, you have a typo in the successful-delete message: "contian"