Opened 2 years ago

Closed 3 months ago

Last modified 2 months ago

#117 closed enhancement (fixed)

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

Reported by: ftputiluser Owned by: schwa
Priority: major Milestone: 4.0.0
Component: Library Version: 3.4
Keywords: makedirs, exist_ok Cc:

Description

thank you for this library.

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

Change History (5)

comment:1 Changed 2 years ago by schwa

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.

comment:2 Changed 2 years ago by schwa

Summary: let makedirs accept exist_ok=False as argumentLet makedirs accept `exist_ok` as argument and fix default behavior

comment:3 Changed 4 months ago by schwa

Keywords: makedirs exist_ok added
Milestone: 4.0.0
Status: newassigned
Version: 3.4

comment:4 Changed 3 months ago by schwa

Resolution: fixed
Status: assignedclosed

Fixed in [f16e9b5084b3].

comment:5 Changed 2 months ago by schwa

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.

Note: See TracTickets for help on using tickets.