get_contents_as_string() returns empty string for nonempty key #1430

bwaldrep opened this Issue Apr 9, 2013 · 0 comments


None yet

1 participant

bwaldrep commented Apr 9, 2013
conn = S3Connection()
bucket = conn.get_bucket(<my bucket name>)
s3key = Key(bucket)
s3key.key = <my key>
result = s3key.get_contents_as_string()

I am writing unit tests for a logger that periodically flushes logs to an S3 bucket. After flushing the logs to S3 I can verify that the key exists using bucket.list() and the AWS console. However, get_contents_as_string() always returns the empty string. Running the test again looking for a key created on a previous test returns the correct value, as does downloading the file from S3 manually.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment