Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

path.iterdir() yields path itself as the first item (with S3) #226

Open
danielgafni opened this issue Jun 20, 2024 · 6 comments
Open

path.iterdir() yields path itself as the first item (with S3) #226

danielgafni opened this issue Jun 20, 2024 · 6 comments
Labels
bug 🐛 Something isn't working

Comments

@danielgafni
Copy link

Given the following objects on S3:

s3://my-bucket/my-directory/0.txt
s3://my-bucket/my-directory/1.txt

UPath("s3://my-bucket/my-directory").iterdir() yields:

s3://my-bucket/my-directory
s3://my-bucket/my-directory/0.txt
s3://my-bucket/my-directory/1.txt

The first item is wrong, right?

@ap--
Copy link
Collaborator

ap-- commented Jun 21, 2024

Hi @danielgafni

Thank you for reporting! Could you check 3 things:

  • did this change with recent fsspec versions? (Just try installing the newest vs installing one from <2024)
  • if you list the contents of the bucket just using filesystem_spec (without upath) does it return an entry named my-bucket/my-directory ?
  • was this s3 bucket manually modified using the AWS webui ? (i.e. Files uploaded via the webui?)

Cheers,
Andreas 😊

@danielgafni
Copy link
Author

danielgafni commented Jun 21, 2024

Hey!

I can answer to (1) and (3) right away:

  1. My fsspec version was 2024.3.1
  2. No, it wasn't

Regarding (2), I will be able to check a bit later

@danielgafni
Copy link
Author

Checked it, seems to be an issue with fsspec. It has this problem too.

@ap--
Copy link
Collaborator

ap-- commented Jun 23, 2024

I wouldn't call it a problem. There's something stored under that key in the bucket. We should just define / document behavior of upath in cases like these.

@danielgafni
Copy link
Author

danielgafni commented Jun 23, 2024

No object with this key exists in the bucket. Also, it happens with any "directory" (common path prefix) in the bucket, not just a specific one.

Also, aws s3 ls doesn't contain the problematic key

@ap--
Copy link
Collaborator

ap-- commented Jun 23, 2024

Could you create a PR with a test case in the upath S3 tests that reproduces the issue? That would be super helpful for finding a solution

@ap-- ap-- added the bug 🐛 Something isn't working label Jul 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants