Message 103684 - Python tracker (original) (raw)

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.. ...