-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
pathlib Path.replace raises OSError when target exists #84459
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The pathlib module https://docs.python.org/3/library/pathlib.html#pathlib.Path.replace I see that others on StackOverflow encounter the same issue. The top answer ignores the Python documentation and recommends removing the target directory before replacing. |
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 : https://bugs.python.org/issue27886 |
The docs for If nothing else, I guess this is a request to alter the docstring. |
…-91853) pythonGH-84459 (cherry picked from commit 161dff7) Co-authored-by: slateny <[email protected]>
…-91853) pythonGH-84459 (cherry picked from commit 161dff7) Co-authored-by: slateny <[email protected]>
GH-84459 (cherry picked from commit 161dff7) Co-authored-by: slateny <[email protected]>
GH-84459 (cherry picked from commit 161dff7) Co-authored-by: slateny <[email protected]>
@AlexWaygood I think this can be closed since all PRs are merged |
…-91853) pythonGH-84459 (cherry picked from commit 161dff7) Co-authored-by: slateny <[email protected]>
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: