3 ms·
There is a small amount of time between the `if` and the `with` where another process can delete the file, hence causing a race condition. Attempting to open th
by selcuka 2y ago
There is a small amount of time between the `if` and the `with` where another process can delete the file, hence causing a race condition. Attempting to open the file and catching any exceptions raised is generally safer.
- NewsaHackO 2y agoOK, that does make sense. Thanks!
- taberiand 2y agoWon't it throw the same "FileNotFound" exception in that case? The issue being bothering to check if it exists in the first place I suppose.
- selcuka 2y agoYes, but it won't log the error as it is clearly the intention of the first check.