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

S3FileSystem.du() FileNotFoundError for paths with empty prefixes #450

Closed
andyfarmerboy opened this issue Mar 30, 2021 · 2 comments · Fixed by #803
Closed

S3FileSystem.du() FileNotFoundError for paths with empty prefixes #450

andyfarmerboy opened this issue Mar 30, 2021 · 2 comments · Fixed by #803

Comments

@andyfarmerboy
Copy link

The .du() method returns a FileNotFoundError if any terminal prefix trees at or below the path root do not contain any files.

path = 'bucket/empty-prefix/'  
print(S3FileSystem.du(path))

#> FileNotFoundError

# (Expected) 
# 0

The method returns a numeric value as expected if all prefixes contain files.

@martindurant
Copy link
Member

Agreed that this should work. See the general discussion at fsspec/filesystem_spec#562 - we could do with a comprehensive set of tests for the object storage backends with paths with/without terminal "/", and with/without deeper-nested contents, across the several methods that do this kind of work.

For now, there is a chance that this particular issue is already fixed on main (soon to be released), because find, used by du, no longer uses the prefix/delimiter approach when maxdepth is not specified.

@ianthomas23
Copy link
Contributor

I have confirmed that this has already been fixed, and I've submitted a PR (#803) to ensure there are no future regressions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants