This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Todd.Rovito
Recipients David.Benjamin, Todd.Rovito, docs@python
Date 2012-10-20.20:24:40
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1350764682.03.0.120431957014.issue16278@psf.upfronthosting.co.za>
In-reply-to
Content
David,
   Thanks for your bug report. Indeed os.rename does not exhibit the same behavior as the documentation describes. 

For Python 3.4 here is the fix I came up with:
"Rename the file or directory src to dst. If dst is a directory that is not empty, OSError will be raised. On Unix, if dst exists and is a file, it will be replaced silently if the user has permission and src is a file. On Unix, if src is a directory and dst is a file NotADirectoryError will be raised. The operation may fail on some Unix flavors if src and dst are on different filesystems. If successful, the renaming will be an atomic operation (this is a POSIX requirement). On Windows, if dst already exists, OSError will be raised even if it is a file."

I have attached a Python 3.4 patch for consideration.  This might not be the best phrasing so please feel free to offer alternatives.
History
Date User Action Args
2012-10-20 20:24:42Todd.Rovitosetrecipients: + Todd.Rovito, docs@python, David.Benjamin
2012-10-20 20:24:42Todd.Rovitosetmessageid: <1350764682.03.0.120431957014.issue16278@psf.upfronthosting.co.za>
2012-10-20 20:24:41Todd.Rovitolinkissue16278 messages
2012-10-20 20:24:41Todd.Rovitocreate