Take the 2-minute tour ×

Here I have an image url. filename is image url

def upload(filename, content)
    conn = S3Connection(aws_access_key, aws_secret_key)
    b = Bucket(conn, bucket_name)
    k = Key(b)
    k.key = filename..split('/')[::-1][0]
    k.set_metadata("Content-Type", 'images/jpeg')

It upload things to the S3 but it shows the error:

/tmp/t.jpeg could not be opened, because the associated helper application does not exist. Change the association in your preferences.

share|improve this question
Which line is throwing the error? It seems likely to me that your problem may not be in the piece of code you pasted. –  Gintautas Miliauskas Nov 18 '10 at 12:31
This seems like an error message you get when trying to open the JPEG image in Firefox/Windows. You can always open JPEG images with Windows Photo Viewer. Check that you the application to open *.jpg and *.jpeg files is correctly associated in Firefox or Windows. –  scoffey Nov 18 '10 at 15:54

2 Answers 2

I'm pretty sure images/jpeg is a typo. The correct mimetype is:

share|improve this answer

This line has some syntax error. replace .. with .

Check your file permission for the image file you are trying to read. From the error message it seems like you, or at least your program don't have read access to that file.

share|improve this answer

Your Answer


