I am trying to use boto
to open a .zip
file I have in s3
. I am trying to work with the data directly, I want to avoid creating temporary f
You should look into the python module gzip :
https://docs.python.org/2/library/gzip.html
you should be able to stringIO with gzip. .
from boto.s3.connection import S3Connection
import gzip
from StringIO import StringIO
S3Conn = S3Connection() # assuming your .boto has been setup
Bucket = S3Conn.get_bucket('my_bucket')
my_list = [gzip.GzipFile(fileobj=(StringIO(ele.get_contents_as_string()))) for ele in Bucket.list()]
#for readability I pulled this out
for item in my_list:
item.read()
for readability the list comprehension should probably be broken up - but I followed your original posting to compare.
Good luck!