`FileNotFoundError` when using `download_file` method of s3 client object.
See original GitHub issueDescribe the bug
When running download_file
method of an s3 client object I am receiving this very unexpected error (see below traceback). Within the inner workings of boto it seems to be looking for a file at destination path, plus some random characters appended to the end (.6E57BFFa
).
Strangely this code was working yesterday.
I’ve also tested in a minimal example outside of the code base and the same error persists.
I’ve tested with multiple files in multiple buckets.
Expected Behavior
I expected the download_file
method to work as designed without throwing this error.
Current Behavior
File "/home/nickpestell/apha-csu/repos/btb-phylo/utils.py", line 117, in s3_download_file
s3.download_file(bucket, key, dest)
File "/home/nickpestell/python-virtualenvs/btb-phylo/lib/python3.8/site-packages/boto3/s3/inject.py", line 190, in download_file
return transfer.download_file(
File "/home/nickpestell/python-virtualenvs/btb-phylo/lib/python3.8/site-packages/boto3/s3/transfer.py", line 320, in download_file
future.result()
File "/home/nickpestell/python-virtualenvs/btb-phylo/lib/python3.8/site-packages/s3transfer/futures.py", line 103, in result
return self._coordinator.result()
File "/home/nickpestell/python-virtualenvs/btb-phylo/lib/python3.8/site-packages/s3transfer/futures.py", line 266, in result
raise self._exception
File "/home/nickpestell/python-virtualenvs/btb-phylo/lib/python3.8/site-packages/s3transfer/tasks.py", line 139, in __call__
return self._execute_main(kwargs)
File "/home/nickpestell/python-virtualenvs/btb-phylo/lib/python3.8/site-packages/s3transfer/tasks.py", line 162, in _execute_main
return_value = self._main(**kwargs)
File "/home/nickpestell/python-virtualenvs/btb-phylo/lib/python3.8/site-packages/s3transfer/download.py", line 642, in _main
fileobj.seek(offset)
File "/home/nickpestell/python-virtualenvs/btb-phylo/lib/python3.8/site-packages/s3transfer/utils.py", line 378, in seek
self._open_if_needed()
File "/home/nickpestell/python-virtualenvs/btb-phylo/lib/python3.8/site-packages/s3transfer/utils.py", line 361, in _open_if_needed
self._fileobj = self._open_function(self._filename, self._mode)
File "/home/nickpestell/python-virtualenvs/btb-phylo/lib/python3.8/site-packages/s3transfer/utils.py", line 272, in open
return open(filename, mode)
FileNotFoundError: [Errno 2] No such file or directory: '/mnt/fsx-042/share/phyloConsensus/phyloConsensus/AF-12-01538-15.fas.6E57BFFa'
Reproduction Steps
I expect this will not reproduce but I am simply running:
s3 = boto3.client('s3')
s3.download_file(<bucket>, <key>, <dest>)
where bucket
, key
and dest
are all correctly formatted.
Possible Solution
No response
Additional Information/Context
No response
SDK version used
‘1.24.28’
Environment details (OS name and version, etc.)
ubuntu 20.04
Issue Analytics
- State:
- Created a year ago
- Comments:12 (3 by maintainers)
Top Results From Across the Web
No such file or directory when downloading a file using boto3 ...
See the answer of this post : Boto3 to download all files from a S3 Bucket. It separates the processing of the directories...
Read more >Downloading a File from an S3 Bucket - Amazon AWS
This example shows how to download a file from an S3 bucket, using S3.Bucket.download_file(). Prerequisites¶. To set up and run this example, you...
Read more >Resolve errors uploading data to or downloading data ... - AWS
I want to download data from Amazon Aurora and upload it to Amazon S3. How can I resolve an error I received while...
Read more >How to upload a file to Amazon S3 in Python - Medium
For more on different ways to use your AWS credentials, please check here. And that's it. Please let me know if there's a...
Read more >Why can't I access a specific folder or file in my Amazon S3 ...
If Object Ownership is set to "BucketOwnerPreferred", objects that are newly written by other accounts with the bucket-owner-full-control canned ACL transition ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@FyzHsn the behavior you’re describing (a folder object is created if you use the S3 console to create
folder/
, but a folder object does not get created if an object is uploaded tofolder/dog.png
via boto3) is standard behavior across all S3 SDKs, not a bug. In the general case, there are no folder objects in S3 at all. An objectfolder/dog.png
can exist without an objectfolder/
existing. Folders are, in a sense, virtual and inferred from key prefixes in existing objects.Greetings! It looks like this issue hasn’t been active in longer than five days. We encourage you to check if this is still an issue in the latest release. In the absence of more information, we will be closing this issue soon. If you find that this is still a problem, please feel free to provide a comment or upvote with a reaction on the initial post to prevent automatic closure. If the issue is already closed, please feel free to open a new one.