0

In a Python project, at some point we copy data with shutil.copy2 and shutil.copytree and we have seen after a while that some files are corrupted, but we are not sure if this is the Python copy or other stuff that corrupted it.

Then the question, since I could not find in shutil documentation (https://docs.python.org/3/library/shutil.html) a clear statement saying in case of error there is an exception, especially in case of corrupted copy. Anyone knows if there is somewhere this is confirmed?

eyllanesc
  • 235,170
  • 19
  • 170
  • 241
gluttony
  • 402
  • 6
  • 14
  • 1
    `shutil.__file__` returns the path to the source code. You can review that using your favorite editor if you're concerned. –  Mar 11 '21 at 17:05
  • Thanks @JustinEzequiel for the __file__, I found that at the very end the copy is made with ```with open(src, 'rb') as fsrc, open(dst, 'wb') as fdst``` then basically read fsrc and write to fdst, I'll then look further to it – gluttony Mar 12 '21 at 12:14

0 Answers0