S3FileSystem.exists throwing inaccurate FILENOTFOUND
See original GitHub issueI am still having the same issue when I am trying to create dask dataframe form s3. I did make sure anon=False
when I create the interface object. It is a sporadic problem. Not sure why. I have troubleshot my code with boto3 s3 client and s3 object. They both agreed the file is on S3 but s3fs exists
is returning ‘Filenotfound’.
client = boto3.client('s3')
def check(s3, bucket, key):
try:
r=s3.head_object(Bucket=bucket, Key=key)
except ClientError as e:
return int(e.response['Error']['Code']) != 404 #e.response['Error'] #
return True
check(client, bucket, key))
#########################################################
resource = boto3.resource('s3')
s3resource.Object(bucket,key).get()
except botocore.exceptions.ClientError as e:
if e.response['Error']['Code'] == "404":
return False
else: raise
else:
return True
Issue Analytics
- State:
- Created 4 years ago
- Comments:52 (22 by maintainers)
Top Results From Across the Web
S3FileSystem.exists throwing inaccurate FILENOTFOUND #253
I have troubleshot my code with boto3 s3 client and s3 object. They both agreed the file is on S3 but s3fs exists...
Read more >API — S3Fs 2022.11.0+4.g5917684 documentation
Raises exception if, for instance, the path already exists but is a file. Parameters. path: str. leaf directory name. exist_ok: bool (False). If...
Read more >check if a key exists in a bucket in s3 using boto3
Boto 2's boto.s3.key.Key object used to have an exists method that checked if the key existed on S3 by doing a HEAD request...
Read more >S3FileSystem (Apache Hadoop Main 2.6.0 API)
Parameters: f - given path; Returns: the statuses of the files/directories in the given patch; Throws: FileNotFoundException - when the path does not...
Read more >S3FileSystem (Apache Hadoop Main 2.0.3-alpha API)
Parameters: f - given path; Returns: the statuses of the files/directories in the given patch; Throws: FileNotFoundException - when the path does not...
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
We are running into this exact issue in our project too, @martindurant. We would greatly appreciate any updates/workarounds.
@TomAugspurger we were checking for the existence of the file in a dense folder. While stepping through the codebase with the debugger, it leads to
exists
->info
->ls
, where the result ofls
is exactly 1000 files. The folder itself contains 4226 files and the file in question is the last one (given the sorting by name).The fact that
ls
returns only first 1000 files is a known issue. We are always using a custom paginator to list directory contents.