s3fs icon indicating copy to clipboard operation
s3fs copied to clipboard

pathlib.Path syntax not supported?

Open kasuteru opened this issue 3 years ago • 1 comments

Some functions crash when trying to use pathlib.Path-like syntax. Is this intentional (e.g. s3fs does not intend to support pathlib.Path, only str, or is this a bug?

pathlib is for many libraries now the default way to handle paths, since it has a lot of benefits over plain strings.

An example of a function that crashes when providing a pathlib.PurePosixPath is the ._rm functionality.

kasuteru avatar Aug 15 '22 09:08 kasuteru

pathlib is designed for local paths only, and from our point of view an extra burden, given it provides no convenience: we need to deal with path strings in different ways in different backends anyway. Also, it is really easy for the calling code to convert to str before passing to fsspec. Having said that, most user-facing API points do accept pathlib and convert to str at the first opportunity via _strip_protocol. I suppose _rm is not one of these (but rm works?).

martindurant avatar Aug 15 '22 13:08 martindurant