[issue40278] pathlib Path.replace raises OSError when target exists

2020-04-13 Thread Michael Selik
Michael Selik added the comment: The docs for ``os.replace`` says "If dst is a directory, OSError will be raised." That's helpful, but the docs for ``pathlib.Path.replace`` make it seem like the target will be unconditionally replaced regardless of whether it's a file or directory. Sure, t

[issue40278] pathlib Path.replace raises OSError when target exists

2020-04-13 Thread Karthikeyan Singaravelan
Karthikeyan Singaravelan added the comment: replace under the hood uses os.replace. The docs for os.replace indicate error for certain scenarios where target is a directory : https://docs.python.org/3/library/os.html#os.replace . See also some difference between os.rename and os.replace : ht

[issue40278] pathlib Path.replace raises OSError when target exists

2020-04-13 Thread Michael Selik
New submission from Michael Selik : The pathlib module ``Path.replace(target)`` states that "If target points to an existing file or directory, it will be unconditionally replaced." However, this does not appear to be true. I experience an OSError ``[Errno 66] Directory not empty`` when att