New submission from Thomas Kluyver:

shutil.copytree behaves differently with symlinks depending on the 'symlinks' 
parameter. If this is True, symlinks are replicated in the destination. If 
False, the contents of the targets are copied to the destination.

With symlinks=False, it currently assumes that all symlinks are pointing to 
regular files. With a symlink to a directory, it tries to copy it using the 
file copy function, which fails with:

[Errno 21] Is a directory: '/tmp/tmpouavxt1u/link_to_dir'"

The attached patch adds an isdir() check to use copytree instead in that case. 
A test is also added.

----------
components: Library (Lib)
files: shutil_copytree_symlink_dir.patch
keywords: patch
messages: 246585
nosy: takluyver
priority: normal
severity: normal
status: open
title: shutil.copytree fails with symlinks to directories when symlink=False
versions: Python 3.4, Python 3.5, Python 3.6
Added file: http://bugs.python.org/file39892/shutil_copytree_symlink_dir.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue24609>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to