[issue6547] shutil.copytree fails on dangling symlinks
Tarek Ziadé
report at bugs.python.org
Tue Apr 20 11:07:18 CEST 2010
Tarek Ziadé <ziade.tarek at gmail.com> added the comment:
Added in r80244. This new option willl be available in the next 3.2 release. Until 3.2 is released, what you can do is catch the errors
and re-raise the ones that are not due to dangling symlinks:
(not tested)
>>> from shutil import copytree, Error
>>> try:
... shutil.copytree('../test', '../test2')
... except Error, e:
... for src, dst, error in e.args[0]:
... if not os.path.islink(src):
... raise
... else:
... linkto = os.readlink(srcname)
... if os.path.exists(linkto):
... raise
... # dangling symlink found.. ignoring..
...
----------
status: open -> closed
versions: +Python 3.2, Python 3.3 -Python 2.6
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue6547>
_______________________________________
More information about the Python-bugs-list
mailing list