New submission from desbma <dutch...@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 <rep...@bugs.python.org>
<https://bugs.python.org/issue32073>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to