STINNER Victor added the comment: On Python 3 on Windows, os.rename() is implemented as MoveFileExW() with flags=0.
The doc says: "When moving a file, the destination can be on a different file system or volume. If the destination is on another drive, you must set the MOVEFILE_COPY_ALLOWED flag in dwFlags." https://msdn.microsoft.com/en-us/library/windows/desktop/aa365240%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396 I guess that the portable fix is to try rename() or fall back on copy(src, dst) + delete(src). -- On Python 2 on Windows, os.rename() is implemented as MoveFileW(). It seems like this function behaves as MoveFileEx() called with MOVEFILE_COPY_ALLOWED: "A new file may be on a different file system or drive." https://msdn.microsoft.com/en-us/library/windows/desktop/aa365239(v=vs.85).aspx -- Should we add a flag to os.rename() to allow copy, to have a portable API? ---------- components: +Windows nosy: +haypo, paul.moore, steve.dower, tim.golden, zach.ware title: os.rename different in python 2.7.12 and python 3.5.2 -> Windows: os.rename different in python 2.7.12 and python 3.5.2 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue28356> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com