Copying a folder over with Shutil while saving to a file within it. What will happen?

103 views Asked by At

Two different areas of my code deal with a directory. One copies the directory every 6 minutes to a new location. The other randomly will save to a file within the directory on rare occasion. I used shutil.copytree for the directory copy and df.to_excel with Pandas to write to a *.ods in that folder. I wrapped both with repeating Try and Excepts that loop 10 times with a .2 second pause. My hope was if there was a syncronous collision that it would eventually succeed within the 2 seconds of retries via the try and excepts. What happens if the shutil copies the folder while pandas is trying to write to a *.ods in the folder??? Will one wait for the other or will one corrupt data?

0

There are 0 answers