-
Notifications
You must be signed in to change notification settings - Fork 41
Backslash doesn't split to child trees #250
Comments
Good catch. Yes I expect this is because I used Q: Do you think backward slashes should be coerced into forward ones? Or an error raised? Presumably we do not want two valid separator characters? |
Windows uses backslash by default and coerces forward slashes to backslashes, I think we should handle both. I'm hoping pathlib has a good trick for this but I haven't looked in to this enough. Edit: |
If we're lucky then changing |
Why do you say this? You're talking about a case where a datatree is created from a url, but on a windows machine? |
Yes, I just noticed the urls on the browser is forward slashes on my windows computer. And I was thinking someone could experience that case as well. |
Interesting. Is it possible to create a datatree from a url right now though? Where slashes in the url become levels in the tree? |
I don't know, I haven't tried it yet. The url-checks in |
Thinking about this again, I don't think we should support multiple separators in the node paths. The node paths have nothing to do with the filesystem, they don't represent files on disk. We might however want to help the user when opening from or saving to multiple files, in which case on Windows we should convert backslashes in filepaths into forward slashes in node paths, and back again when saving. Until we actually have an |
I don't think we should support backslashes in datatree paths either, group paths should have nothing to do with filesystem paths (just like urls this should always be the same across operating systems). Closing, but if you want to continue discussing please open a new issue on the xarray repository. |
I'm guessing this is a Windows vs. Linux thing? For example, there's PurePosixPath usage here:
datatree/datatree/treenode.py
Line 30 in a206e72
https://docs.python.org/3/library/pathlib.html#pathlib.PurePosixPath
https://docs.python.org/3/library/pathlib.html#pathlib.PureWindowsPath
I'm guessing adding a Windows CI might find some more issues.
The text was updated successfully, but these errors were encountered: