I am using boto3 to download a file and then copy in tmp file on lambda funtions. I am using this function to download a file
S3_BUCKET_NAME = 'dev-bucket'
key = 'uploads/random.xlsx'
s3.download_file(S3_BUCKET_NAME, key, 'tmp/hello2.xlsx')
but I am getting this error
FileNotFoundError: [Errno 2] No such file or directory: 'tmp/hello2.xlsx.a56DfB10'
am I doing something wrong here?
Change tmp/hello2.xlsx
into: /tmp/hello2.xlsx
Without the leading slash, it will go to a relative path .
By including the leading slash, it will go to an absolute path , which is what you need.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.