I am a relative newbie to Python, and I have searched and while there are many posts regarding the error, none appear to address my requirement.
Briefly, I am writing code to hourly reports. I intend to have 4 days of reports archived in the folder. At the beginning of my code I have one line that deletes all 24 files for reports generated 5 days earlier.
The first run is fine, as the program finds files to delete, so it will continue to run to a successful completion. However, the next 23 runs will fail as the programs fails with a "No such file or directory" error.
My work-around is to write code where it only executes the "delete" function on the first hour's run, but I consider that just a band-aid solution. I would prefer to code an exception so that the remaining code is processed even though the first step got that error.