4

I need to read the content of an audio file which is stored in AWS using boto3. To do that right now I am doing something like this:

client = boto3.client('s3')
client.download_file(obj.bucket, obj.key, "temp.mp3")

However it is not downloading the file and giving me a clientError something like this:

An error occurred (404) when calling the HeadObject operation: Not Found

I am not sure what HeadObject is. is there any alternate way to read the content of a file stored in specific bucket at a specific key?

Nik391
  • 517
  • 2
  • 7
  • 24
  • 2
    I suggest you start by reviewing the answers to all the questions on here that your question is a duplicate of, such as: http://stackoverflow.com/questions/29378763/how-to-save-s3-object-to-a-file-using-boto3 and http://stackoverflow.com/questions/31976273/open-s3-object-as-a-string-with-boto3 and http://stackoverflow.com/questions/36205481/read-file-content-from-s3-bucket-with-boto3 – Mark B Aug 09 '16 at 20:27
  • @MarkB this question seems to be about the HeadObject error, not how to download a file, although I admit the wording of the last line is confusing. – tenpn Apr 06 '17 at 15:15
  • As @tenpn mentioned, you should make it clear what the `obj` is in here. The piece of code you use for downloading seems to be correct. – Pedram Jun 19 '17 at 02:38
  • 1
    Possible duplicate of [How to save S3 object to a file using boto3](https://stackoverflow.com/questions/29378763/how-to-save-s3-object-to-a-file-using-boto3) – Akshay Hazari Sep 14 '17 at 07:38

0 Answers0