You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This fix solves the Windows issue, but since delete=False is used, the temp image files won’t be deleted automatically and may be left on disk.
Maybe it would be better to wrap this in a try/finally block and remove the file manually after it has been used.
Don’t you think?
Thanks for the insight! You were right, the temp files would remain on the disk when delete=False is used. I used os.remove() to explicitly remove those temp files using the try/except block in case of FileNotFoundError. I verified that the temp files do not remain on the disk after the changes were made. Pushed the fix.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #676 tests failing on Windows due to NamedTemporaryFile locking.
On Windows, NamedTemporaryFile locks the file while open, causing
PermissionError when the code tries to read it. Adding delete=False
resolves this.
Fixes: 8 failing tests on Windows