Jun-08-2019, 12:51 AM
i just wrote a function and will be writing tests for it soon. i wrote it because i frequently need this. it mimics
one thing i noticed with error messages and exception messages from pathlib is that messages like to reference the full original argument path that was passed as an argument. since i had to run my own loop to set the mode on each directory being created, i chose to add the parent directory path in my messages.
open()
(by calling it at the end) but creates any needed parent directories along with support for a named parameter parentsmode=
to set the creation mode for all the parents being created (existing ones are not changed). i call it opend()
. it uses pathlib to work out the parents. do you think i wasted my time?one thing i noticed with error messages and exception messages from pathlib is that messages like to reference the full original argument path that was passed as an argument. since i had to run my own loop to set the mode on each directory being created, i chose to add the parent directory path in my messages.