Fixed bug with NamedTemporaryFile on Windows#4
Merged
Merged
Fixed bug with NamedTemporaryFile on Windows#4
Conversation
Changed NamedTemporaryFile to be manually deleted isntead of automatic. We delete it manually because otherwise on Windows it gets deleted before we the temp file is saved to the output file location. This is because on Windows, file handles with the O_TEMPORARY flag (which is set if we pass `delete=True`) are deleted as soon as they're closed.
c-w
requested changes
May 30, 2020
Member
c-w
left a comment
There was a problem hiding this comment.
Thanks for the contribution and fix. I made a follow-up task to also run the CI on Windows (e.g. via Github Actions) so that we can spot these sorts of issues in the future (see #5).
I see that the CI is currently failing (just flake8 complaining about line length so should be quick to fix). Could you take care of this and then I'd say this is ready for merge.
c-w
approved these changes
May 31, 2020
Member
c-w
left a comment
There was a problem hiding this comment.
Just pushed a change to fix the formatting so this is ready to go. Thanks so much for your contribution!
Member
|
This fix has been released in version 0.0.4. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Changed NamedTemporaryFile to be manually deleted isntead of automatic. We delete it manually because otherwise on Windows it gets deleted before we the temp file is saved to the output file location. This is because on Windows, file handles with the O_TEMPORARY flag (which is set if we pass
delete=True) are deleted as soon as they're closed.See the docs at https://docs.python.org/3/library/tempfile.html#tempfile.NamedTemporaryFile
"Whether the name can be used to open the file a second time, while the named temporary file is still open, varies across platforms (it can be so used on Unix; it cannot on Windows NT or later). If delete is true (the default), the file is deleted as soon as it is closed. The returned object is always a file-like object whose file attribute is the underlying true file object. This file-like object can be used in a with statement, just like a normal file."