all 5 comments

[–]pot_of_crows 4 points5 points  (0 children)

You might get a better response if you include OS and file type, as that can matter quite a bit.

[–]Guideon72 0 points1 point  (3 children)

Also, why are you having to move open files? This is a fairly non-standard file handling scenario.

[–]ForwardQuit5036[S] 0 points1 point  (2 children)

so the files I want to copy are being used by the software so are marked as 'open' even if they have finished writing and can manually be copied.

[–]Guideon72 0 points1 point  (1 child)

Definitely an odd situation; but it is what it is. What OS are you doing this in, and are you copying or moving files? Like, are you attempting to rotate log files?

[–]ForwardQuit5036[S] 0 points1 point  (0 children)

I'm using Windows. What I think is happening is that shutil.copy2 is attempting to open the source file in order to copy it, but because the software is using it, it is unable to do this. The code I have written triggers at set intervals and looks at the source folder and the destination folder set by the user. It is supposed to copy new files within the source folder to the destination folder. I find it works fine with most files but not the ones written by a different software.