[New-bugs-announce] [issue32073] Add copy_directory_metadata parameter to shutil.copytree

desbma report at bugs.python.org
Sat Nov 18 14:13:27 EST 2017


New submission from desbma <dutch109 at gmail.com>:

I am sometimes using shutil.copytree to copy a directory to a destination that does not support setting metadata (like MTP mounts of Android devices).

Using the copy_function parameter allows passing shutil.copy or a custom function to ignore file metadata, however currently shutil.copytree always tries to call copystat on directories, which can fail with OSError (errno set to ENOTSUPP).

The code assumes copystat can fail on Windows, but propagates the error on other OS, even though the tree copy actually succeeds.
See https://github.com/python/cpython/blob/9bb6fe52742340f6c92f0dda18599a4577a94e18/Lib/shutil.py#L352-L357

----------
components: Library (Lib)
messages: 306494
nosy: desbma
priority: normal
severity: normal
status: open
title: Add copy_directory_metadata parameter to shutil.copytree
type: enhancement
versions: Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue32073>
_______________________________________


More information about the New-bugs-announce mailing list