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

Why isn't Pathlib supported yet? #870

Open
yashsandansing opened this issue Apr 18, 2024 · 1 comment
Open

Why isn't Pathlib supported yet? #870

yashsandansing opened this issue Apr 18, 2024 · 1 comment

Comments

@yashsandansing
Copy link

Trying to do

s3fs.open('bucket/file.ext') as fp

apparently gives a

attempt to load non key-like path

error, which apparently happened because the library was passing a Path instead of a string

Most libraries now use Path objects instead of str and finding out such an error is like finding a needle in a haystack.
Why not implement Path supported operations in s3fs itself instead of expecting everyone using it to add additional functionalities to change it to str?

@martindurant
Copy link
Member

As the documentation for Path makes clear, it is intended to be used with local paths only. If you apply them to remote storage, you often have to worry about the specifics of windows versus posix, making like complicated (fsspec/filesystem_spec#1574 with exactly this problem). May I suggest you use universal_pathlib ( https://github.com/fsspec/universal_pathlib ) if you really require Path-like functionality.

which apparently happened because the library was passing a Path instead of a string

The cannot have read the docstring.

        Parameters
        ----------
        path: str
            Target file
...

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

No branches or pull requests

2 participants