-
Notifications
You must be signed in to change notification settings - Fork 43
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
Weird result with as_uri() on s3 files #115
Comments
Hi @mberlinger3, thank you for opening an issue! It seems class UPath(...):
def as_uri(self):
return str(self) would you be interested in adding tests and a patch in a PR? Cheers, |
I think this would make more sense on the non-local (cloud?) implementations because it looks like the as_uri() method is currently inherited from the standard pathlib implementation which is correct for local files. Perhaps a specific wrapper in the UPath class to explicitly call the pathlib implementation and separate methods for the differing schemes. |
Local paths that aren't provided via a file uri are currently returned as their corresponding As it stands right now, >>> import upath
>>> upath.UPath("file://a/b/c.dat").as_uri()
'file://file%3A//a/b/c.dat' So a general fix in |
I see what is issue is here. If you instantiate UPath using a uri as above it breaks; however, if you use a file path then as_uri works as expected. >>> from upath import UPath
>>> print( UPath("/a/b/c.dat").as_uri() )
file:///a/b/c.dat This could likely be solved by a simple conditional to check if a scheme exists and pass it to pathlib if it doesn't. We could probably implement the scheme check as a simple property. An alternative solution would be something like what s3path does. They have a method |
The as_uri() attribute of an s3path looks like it is returning a file of an encoded url; however, it should really be likely a reimplementation of the .as_posix() attribute which would return the same as the input below.
Found this because for some reason polars doesnt like UPaths unless the .as_posix() property is used.
The text was updated successfully, but these errors were encountered: