[ python-Bugs-1693753 ] Portability issue: os.rename behaves differently on win32

SourceForge.net noreply at sourceforge.net
Tue May 1 17:02:53 CEST 2007


Bugs item #1693753, was opened at 2007-04-03 18:17
Message generated for change (Comment added) made by loewis
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1693753&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: Platform-specific
>Status: Closed
>Resolution: Wont Fix
Priority: 5
Private: No
Submitted By: cs_ (cs_)
Assigned to: Nobody/Anonymous (nobody)
Summary: Portability issue: os.rename behaves differently on win32

Initial Comment:
os.rename(src, dst) fails on Windows if dst already exist and regular file. On Unixes, it does not fail, and silently overwrites dst. It's better to use MoveFileEx(src, dst, MOVEFILE_REPLACE_EXISTING) when moving regular files under Win32 to make it behave consistent way.

----------------------------------------------------------------------

>Comment By: Martin v. Löwis (loewis)
Date: 2007-05-01 17:02

Message:
Logged In: YES 
user_id=21627
Originator: NO

This change would be an incompatible change; see the discussion of the
proposed patch. Closing this report as "won't fix".

----------------------------------------------------------------------

Comment By: Raghuram Devarakonda (draghuram)
Date: 2007-04-23 00:48

Message:
Logged In: YES 
user_id=984087
Originator: NO


I submitted a patch for this (1704547)

----------------------------------------------------------------------

Comment By: Raghuram Devarakonda (draghuram)
Date: 2007-04-12 18:35

Message:
Logged In: YES 
user_id=984087
Originator: NO


>From MSDN document and googling, it does look like
MOVEFILE_REPLACE_EXISTING guarantees atomicity for rename operation. I will
see if I can come up with a patch (I will first need to learn building
python on windows).

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1693753&group_id=5470


More information about the Python-bugs-list mailing list