{"action":"created","issue":{"url":"https://api.github.com/repos/boto/boto3/issues/1597","repository_url":"https://api.github.com/repos/boto/boto3","labels_url":"https://api.github.com/repos/boto/boto3/issues/1597/labels{/name}","comments_url":"https://api.github.com/repos/boto/boto3/issues/1597/comments","events_url":"https://api.github.com/repos/boto/boto3/issues/1597/events","html_url":"https://github.com/boto/boto3/issues/1597","id":332444300,"node_id":"MDU6SXNzdWUzMzI0NDQzMDA=","number":1597,"title":"S3 client `download_file` misleading `Max Retries Exceeded` error when `Filename` path doesn't exist","user":{"login":"atrepca","id":2030087,"node_id":"MDQ6VXNlcjIwMzAwODc=","avatar_url":"https://avatars2.githubusercontent.com/u/2030087?v=4","gravatar_id":"","url":"https://api.github.com/users/atrepca","html_url":"https://github.com/atrepca","followers_url":"https://api.github.com/users/atrepca/followers","following_url":"https://api.github.com/users/atrepca/following{/other_user}","gists_url":"https://api.github.com/users/atrepca/gists{/gist_id}","starred_url":"https://api.github.com/users/atrepca/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/atrepca/subscriptions","organizations_url":"https://api.github.com/users/atrepca/orgs","repos_url":"https://api.github.com/users/atrepca/repos","events_url":"https://api.github.com/users/atrepca/events{/privacy}","received_events_url":"https://api.github.com/users/atrepca/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-06-14T15:07:24Z","updated_at":"2018-10-15T23:10:38Z","closed_at":null,"author_association":"NONE","body":"Hello,\r\n\r\nWhen using `download_file()` to copy from S3, if the destination path doesn't exist boto3 throws a misleading `Max Retries Exceeded` error.\r\n\r\nIn the example below `dummy` in `/var/dummy/my-file.txt` is a non-existing path.\r\n```\r\n$ python3\r\nPython 3.5.2 (default, Nov 23 2017, 16:37:01) \r\n[GCC 5.4.0 20160609] on linux\r\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\r\n>>> import boto3\r\n>>> import botocore\r\n>>> \r\n>>> BUCKET_NAME = 'my-bucket'\r\n>>> KEY = 'my-file.txt'\r\n>>> \r\n>>> s3 = boto3.resource('s3')\r\n>>> \r\n>>> try:\r\n...     s3.Bucket(BUCKET_NAME).download_file(KEY, '/var/dummy/my-file.txt')\r\n... except botocore.exceptions.ClientError as e:\r\n...     if e.response['Error']['Code'] == \"404\":\r\n...         print(\"The object does not exist.\")\r\n...     else:\r\n...         raise\r\n... \r\n\r\nTraceback (most recent call last):\r\n  File \"<stdin>\", line 2, in <module>\r\n  File \"/usr/lib/python3/dist-packages/boto3/s3/inject.py\", line 129, in bucket_download_file\r\n    ExtraArgs=ExtraArgs, Callback=Callback, Config=Config)\r\n  File \"/usr/lib/python3/dist-packages/boto3/s3/inject.py\", line 91, in download_file\r\n    extra_args=ExtraArgs, callback=Callback)\r\n  File \"/usr/lib/python3/dist-packages/boto3/s3/transfer.py\", line 658, in download_file\r\n    extra_args, callback)\r\n  File \"/usr/lib/python3/dist-packages/boto3/s3/transfer.py\", line 673, in _download_file\r\n    self._get_object(bucket, key, filename, extra_args, callback)\r\n  File \"/usr/lib/python3/dist-packages/boto3/s3/transfer.py\", line 707, in _get_object\r\n    raise RetriesExceededError(last_exception)\r\nboto3.exceptions.RetriesExceededError: Max Retries Exceeded\r\n```\r\n\r\nAn error message suggesting the path is not there would be helpful.\r\n\r\nThanks!"},"comment":{"url":"https://api.github.com/repos/boto/boto3/issues/comments/430045123","html_url":"https://github.com/boto/boto3/issues/1597#issuecomment-430045123","issue_url":"https://api.github.com/repos/boto/boto3/issues/1597","id":430045123,"node_id":"MDEyOklzc3VlQ29tbWVudDQzMDA0NTEyMw==","user":{"login":"kyleknap","id":4605355,"node_id":"MDQ6VXNlcjQ2MDUzNTU=","avatar_url":"https://avatars0.githubusercontent.com/u/4605355?v=4","gravatar_id":"","url":"https://api.github.com/users/kyleknap","html_url":"https://github.com/kyleknap","followers_url":"https://api.github.com/users/kyleknap/followers","following_url":"https://api.github.com/users/kyleknap/following{/other_user}","gists_url":"https://api.github.com/users/kyleknap/gists{/gist_id}","starred_url":"https://api.github.com/users/kyleknap/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kyleknap/subscriptions","organizations_url":"https://api.github.com/users/kyleknap/orgs","repos_url":"https://api.github.com/users/kyleknap/repos","events_url":"https://api.github.com/users/kyleknap/events{/privacy}","received_events_url":"https://api.github.com/users/kyleknap/received_events","type":"User","site_admin":false},"created_at":"2018-10-15T23:10:38Z","updated_at":"2018-10-15T23:10:38Z","author_association":"MEMBER","body":"Sorry for the late response on this. Thanks for the debug logs. I would recommend upgrading to the latest version of `boto3`. It looks like in newer versions of `boto3` this bad error message no longer exists and we also no longer do unnecessary retries for it. Let us know if that helps."}}
{"actor":{"display_login":"kyleknap"}}