Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix inability to replace existing file on Windows #22

Merged
merged 1 commit into from
Jan 15, 2019

Conversation

mjreed-wbd
Copy link
Collaborator

os.rename fails on Windows if the target filename exists. os.replace works in that case (as long as the file is not in use), but that only exists in Python 3.3+. This change maintains compatibility with older versions of Python.

The strategy is this: try the rename; if it fails with a FileExistsError, then if os.replace is available, retry the operation with it; otherwise we accept the risk of the race condition by simply deleting the file and then trying the rename again.

To maximize the utility of this change, the Dockerfile has also been updated to build a container based on Python 3.6 instead of 2.7.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant