Re: os independent rename

2011-09-17 Thread Dave Angel
On 01/-10/-28163 02:59 PM, Nobody wrote: On Sat, 17 Sep 2011 20:28:32 +0430, Lee Harr wrote: So, what is the best way to do this that will behave the same across operating systems? Delete the destination first, but after checking that it isn't the same as the source. On Windows, that last bit

Re: os independent rename

2011-09-17 Thread Cameron Simpson
On 17Sep2011 20:18, Nobody wrote: | On Sat, 17 Sep 2011 20:28:32 +0430, Lee Harr wrote: | > So, what is the best way to do this that will | > behave the same across operating systems? | | Delete the destination first, but after checking that it isn't the same as | the source. This is usually a s

Re: os independent rename

2011-09-17 Thread Nobody
On Sat, 17 Sep 2011 20:28:32 +0430, Lee Harr wrote: > So, what is the best way to do this that will > behave the same across operating systems? Delete the destination first, but after checking that it isn't the same as the source. On Windows, that last bit is harder than it seems. A string-based

Re: os independent rename

2011-09-17 Thread Lee Harr
> shutil.move works for me, at least in Python 2.7. The docstring> doesn't > seem to match the code Thanks for checking that. Looks like there is a closed report about the misleading docs:http://bugs.python.org/issue12577 Closed a couple of months ago, but the docs have not madeit to the web ye

Re: os independent rename

2011-09-17 Thread Ian Kelly
On Sat, Sep 17, 2011 at 9:58 AM, Lee Harr wrote: > > I just got a bug report the heart of which is the > difference between unix and windows in using > os.rename > > (ie, "On Windows, if dst already exists, OSError will be raised") > > Hmm, I thought, maybe I'm supposed to use > shutil here. That