python script is not running without sudo - why?
<p>This is my python script which downloads the most recent image from my S3 bucket. When I run this script using <code>sudo python script.py</code> it does as expected, 
but not when I run it as <code>python script.py</code>. In this case, the script finishes cleanly without exceptions or process lockup, but there is no image file.</p>

<p>Why does this happen? Is there something I could do at boto's library end or any other thing?</p>

<pre><code>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()
</code></pre>

<p>Presumably the problem is that you try to store things somewhere your user doesn't have permission to. The second issue is that your script is hiding the error. The <code>except</code> block completely ignores what sort of exceptions occur (and of course consumes them so you never see them), and uses <code>logging.info</code> which by default doesn't show; that should probably be at least a warning and would be better if it showed something about what went wrong. By the way, odds are you shouldn't be posting S3 authentication keys here. </p>

python boto sudo