{"action":"created","issue":{"url":"https://api.github.com/repos/mahmoud/boltons/issues/60","repository_url":"https://api.github.com/repos/mahmoud/boltons","labels_url":"https://api.github.com/repos/mahmoud/boltons/issues/60/labels{/name}","comments_url":"https://api.github.com/repos/mahmoud/boltons/issues/60/comments","events_url":"https://api.github.com/repos/mahmoud/boltons/issues/60/events","html_url":"https://github.com/mahmoud/boltons/issues/60","id":135752958,"number":60,"title":"os.rename called in fileutils breaks on Windows if directory exists","user":{"login":"davidovich","id":1440370,"avatar_url":"https://avatars.githubusercontent.com/u/1440370?v=3","gravatar_id":"","url":"https://api.github.com/users/davidovich","html_url":"https://github.com/davidovich","followers_url":"https://api.github.com/users/davidovich/followers","following_url":"https://api.github.com/users/davidovich/following{/other_user}","gists_url":"https://api.github.com/users/davidovich/gists{/gist_id}","starred_url":"https://api.github.com/users/davidovich/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidovich/subscriptions","organizations_url":"https://api.github.com/users/davidovich/orgs","repos_url":"https://api.github.com/users/davidovich/repos","events_url":"https://api.github.com/users/davidovich/events{/privacy}","received_events_url":"https://api.github.com/users/davidovich/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-02-23T14:34:31Z","updated_at":"2016-02-24T00:09:59Z","closed_at":null,"body":"This was seen in the pip-tools code that is vendoring the AtomicSaver code from boltons.\r\n\r\nhttps://github.com/nvie/pip-tools/pull/322\r\n\r\nin essence, the os.rename cannot be implemented atomically on Windows, but the current code breaks if exercised. (see the issue in pip-tools). \r\n\r\nI will make a PR here as suggested by https://github.com/nvie"},"comment":{"url":"https://api.github.com/repos/mahmoud/boltons/issues/comments/187978541","html_url":"https://github.com/mahmoud/boltons/issues/60#issuecomment-187978541","issue_url":"https://api.github.com/repos/mahmoud/boltons/issues/60","id":187978541,"user":{"login":"mahmoud","id":130193,"avatar_url":"https://avatars.githubusercontent.com/u/130193?v=3","gravatar_id":"","url":"https://api.github.com/users/mahmoud","html_url":"https://github.com/mahmoud","followers_url":"https://api.github.com/users/mahmoud/followers","following_url":"https://api.github.com/users/mahmoud/following{/other_user}","gists_url":"https://api.github.com/users/mahmoud/gists{/gist_id}","starred_url":"https://api.github.com/users/mahmoud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mahmoud/subscriptions","organizations_url":"https://api.github.com/users/mahmoud/orgs","repos_url":"https://api.github.com/users/mahmoud/repos","events_url":"https://api.github.com/users/mahmoud/events{/privacy}","received_events_url":"https://api.github.com/users/mahmoud/received_events","type":"User","site_admin":false},"created_at":"2016-02-24T00:09:59Z","updated_at":"2016-02-24T00:09:59Z","body":"Oh, nice! Thank you for the report. This was something I had on my mind, but I got a bit caught up in research.\r\n\r\nMy back-of-mind plan was to implement MoveFileEx with ctypes, a la: http://stupidpythonideas.blogspot.com/2014/07/getting-atomic-writes-right.html\r\n\r\nHowever, I was given pause by the revelation that MoveFileEx is not atomic: https://msdn.microsoft.com/en-us/library/windows/desktop/aa365240%28v=vs.85%29.aspx\r\n\r\nThat said, given these options versus the current behavior, I'm inclined to do the MoveFileEx ctypes. Time to dust off my Windows test machine :)\r\n\r\nLet me know your thoughts."}}