Rename file without overwriting existing files
Grant Edwards
grant.b.edwards at gmail.com
Mon Jan 30 10:48:16 EST 2017
On 2017-01-30, Jussi Piitulainen <jussi.piitulainen at helsinki.fi> wrote:
> It doesn't seem to be documented. I looked at help(os.link) on Python
> 3.4 and the corresponding current library documentation on the web. I
> saw no mention of what happens when dst exists already.
The functions in the os module are thin-as-possible wrappers around
the OS's libc functions. The authors of the os module don't really
have any way of knowing the details of what your os/libc combination
is going to do.
If you're calling os.foo(), you're sort of expected to know what foo()
does on your OS.
> Also, creating a hard link doesn't seem to work between different file
> systems, which may well be relevant to Steve's case. I get:
>
> OSError: [Errno 18] Invalid cross-device link: [snip]
>
> And that also is not mentioned in the docs.
Again, that's a detail that depends on your particular
OS/libc/filesystem implementation. It's not determined by nor
knowable by the authors of the os module.
--
Grant Edwards grant.b.edwards Yow! I'm ANN LANDERS!!
at I can SHOPLIFT!!
gmail.com
More information about the Python-list
mailing list