question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

S3FileSystem.exists throwing inaccurate FILENOTFOUND

See original GitHub issue

#53

I 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:closed
  • Created 4 years ago
  • Comments:52 (22 by maintainers)

github_iconTop GitHub Comments

5reactions
scuddalocommented, Nov 18, 2019

We are running into this exact issue in our project too, @martindurant. We would greatly appreciate any updates/workarounds.

4reactions
abdullincommented, Nov 22, 2019

@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 of ls 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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found