This is my python script which downloads the most recent image from my S3 bucket. When I run this script using sudo python script.py it does as expected, 
but not when I run it as python script.py. In this case, the script finishes cleanly without exceptions or process lockup, but there is no image file.
Why does this happen? Is there something I could do at boto's library end or any other thing?
import boto
import logging
def s3_download():
    bucket_name = 'cloudadic'
    conn = boto.connect_s3('XXXXXX', 'YYYYYYY')
    bucket = conn.get_bucket(bucket_name)
    for key in bucket.list('ocr/uploads'):
        try:
            l = [(k.last_modified, k) for k in bucket]
            key = sorted(l, cmp=lambda x, y: cmp(x[0], y[0]))[-1][1]
            res = key.get_contents_to_filename(key.name)
        except:
            logging.info(key.name + ":" + "FAILED")
if __name__ == "__main__":
     s3_download()
 
     
     
    