You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A call like cloud_path.download_to("a/b/c/d.txt") will possibly (though not certainly depending on backend, see #56) error if local directories a or b or c does not exist.
This is similar to other pathlib functions, but annoying for developers. Tracking disucssion of the preferred approach in this issue.
Discussion for context:
That is doubly true. First, that pathlib never creates dirs for you, and second that it is inconvenient annoying. In a bunch of our projects we've got a repeated path.parent.mkdir(exist_ok=True, parents=True) before each path write.
I don't feel strongly either way. I didn't track down a reason for pathlib not creating dirs in some cursory searching of the Python bug tracker / mailing list, and I would be curious to see discussion why file creation methods (like write_text for example) wouldn't create the full path. I guess it's not explicitly saying to create a directory, but Path("asdf/asdf/asdf.txt").write_text("asdf") does seem pretty explicit...
In the absence of a reason not to, I'm inclined to create directories since that feels more useful and more like the API I would want to use in my development experience, but happy to punt the discussion to an issue as well.
I guess my inclination is to punt for now. Given that the precedent is to not create directories for you automatically, not just for pathlib, but also for shells like bash, I think it makes sense to standardize at first on that. If we decide otherwise, I think we should make a concerted effort to do that consistently everywhere in cloudpathlib, and also test for it everywhere.
A call like
cloud_path.download_to("a/b/c/d.txt")
will possibly (though not certainly depending on backend, see #56) error if local directoriesa
orb
orc
does not exist.This is similar to other
pathlib
functions, but annoying for developers. Tracking disucssion of the preferred approach in this issue.Discussion for context:
Originally posted by @jayqi in #52 (comment)
The text was updated successfully, but these errors were encountered: