Let makedirs accept `exist_ok` as argument and fix default behavior

thank you for this library.

to fit the pyhton os module it would be nice if makedirs could accept additional args.

ftputiluser (unverified)
Assigned to
6 years ago
6 years ago
enhancement library

schwa (unverified) 6 years ago · edit

Thank you for the report!

I agree, FTPHost.makedirs should accept the exist_ok argument, as os.makedirs does.

When looking at the code, I noticed that the current implementation doesn't accept an exist_ok argument, but behaves as if exist_ok=True was given. However, according to the documentation at ​https://docs.python.org/3/library/os.html#os.makedirs , exist_ok should be False by default.

I plan to change the behavior in a future ftputil 4.0.0, so that makedirs without exist_ok conforms to the Python documentation and the exist_ok argument is supported.

schwa (unverified) 4 years ago · edit

schwa (unverified) 3 years ago · edit

As I meanwhile noticed, the earlier behavior of makedirs in ftputil wasn't a bug, but the actual semantics of os.makedirs in Python 2. On the other hand, Python 3 not only adds the argument exist_ok, but also chooses the default so that the default behavior is different from that in Python 2.

So this issue has to be listed under the backward-incompatible changes in the documentation and in the announcement.

Register here or Log in to comment, or comment via email.