[issue28356] [easy doc] Document os.rename() behavior on Windows when src and dst are on different filesystems

Ryan Ozawa report at bugs.python.org
Sun Jul 25 20:11:03 EDT 2021


Ryan Ozawa <ryan.ozawa21 at gmail.com> added the comment:

Hi all,

This is my first issue so feedback is welcome.

Following @vstinner 's suggestions:
> * os.rename() can fail if source and destination are on two different
file systems
> * Use shutil.move() to support move to a different directory

And from @eryksun :
> ... on Windows the "operation will fail if src and dst are on different filesystems".

Just 2 short lines:
2292,6 +2292,8 @@ features:
    will fail with an :exc:`OSError` subclass in a number of cases:
 
    On Windows, if *dst* exists a :exc:`FileExistsError` is always raised.
+   The operation will fail if *src* and *dst* are on different filesystems. Use
+   :func:`shutil.move` to support moves to a different filesystem.


If nothing to change, I will make a PR soon.

----------
keywords: +patch
nosy: +rhyn0
Added file: https://bugs.python.org/file50180/os_rename_windows.patch

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue28356>
_______________________________________


More information about the Python-bugs-list mailing list