https://pantsbuild.org/ logo
w

wide-energy-11069

09/18/2018, 9:19 PM
interesting. the code does not handle permission issues
Copy code
try:
    os.link(source, dest)
  except OSError as e:
    if e.errno == errno.EEXIST:
      # File already exists.  If overwrite=True, write otherwise skip.
      if overwrite:
        do_copy()
    elif e.errno == errno.EXDEV:
      # Hard link across devices, fall back on copying
      do_copy()
    else:
      raise