Cannot download file from S3 bucket

Viewed 42

I am trying to download an object from my S3 bucket using boto in FastAPI with Docker and the following issue was found:

FileNotFoundError: [Errno 2] No such file or directory

However, when I tried to download the object from S3 in FastAPI without Docker, it worked.

My code:

aws_s3 = boto3.Session(aws_access_key_id=ACCESS_KEY,
                                aws_secret_access_key=SECRET_KEY).resource('s3')

aws_s3.meta.client.download_file(
    bucket_name, object, path)

I can confirm that the path is correct.

The error are as follows:

FileNotFoundError: [Errno 2] No such file or directory: '{path}.xlsx.A9c02F22'

FileNotFoundError: [Errno 2] No such file or directory: '{path}.xlsx.D6Ddda5f'

I am using the following Boto3 sdk version:

boto3=1.24.6, botocore=1.27.6
0 Answers
Related