[Windows] Fix Access Denied when using os.rename()
MEMBER
Cool thank you ! Maybe we can just replace `os.rename` by `shutil.move` instead ?
2022-08-22T15:34:17Z
https://github.com/huggingface/datasets/pull/4825#issuecomment-1222527020
https://api.github.com/repos/huggingface/datasets/issues/4825
IC_kwDODunzps5I3kgs
https://api.github.com/repos/huggingface/datasets/issues/comments/1222527020/reactions
2022-08-22T15:34:17Z
https://api.github.com/repos/huggingface/datasets/issues/comments/1222527020
https://avatars.githubusercontent.com/u/42851186?v=4
https://api.github.com/users/lhoestq/events{/privacy}
https://api.github.com/users/lhoestq/followers
https://api.github.com/users/lhoestq/following{/other_user}
https://api.github.com/users/lhoestq/gists{/gist_id}
https://github.com/lhoestq
lhoestq
MDQ6VXNlcjQyODUxMTg2
https://api.github.com/users/lhoestq/orgs
https://api.github.com/users/lhoestq/received_events
https://api.github.com/users/lhoestq/repos
https://api.github.com/users/lhoestq/starred{/owner}{/repo}
https://api.github.com/users/lhoestq/subscriptions
User
https://api.github.com/users/lhoestq
public
CONTRIBUTOR
> Cool thank you ! Maybe we can just replace `os.rename` by `shutil.move` instead ?

Yes, I think that could be a better solution, but I didn't test it in Linux (e.g. Ubuntu) to guarantee that `os.rename()` could be completely replaced by `shutil.move()`.
2022-08-22T16:32:36Z
https://github.com/huggingface/datasets/pull/4825#issuecomment-1222608082
https://api.github.com/repos/huggingface/datasets/issues/4825
IC_kwDODunzps5I34TS
https://api.github.com/repos/huggingface/datasets/issues/comments/1222608082/reactions
2022-08-22T16:32:36Z
https://api.github.com/repos/huggingface/datasets/issues/comments/1222608082
https://avatars.githubusercontent.com/u/8703022?v=4
https://api.github.com/users/DougTrajano/events{/privacy}
https://api.github.com/users/DougTrajano/followers
https://api.github.com/users/DougTrajano/following{/other_user}
https://api.github.com/users/DougTrajano/gists{/gist_id}
https://github.com/DougTrajano
DougTrajano
MDQ6VXNlcjg3MDMwMjI=
https://api.github.com/users/DougTrajano/orgs
https://api.github.com/users/DougTrajano/received_events
https://api.github.com/users/DougTrajano/repos
https://api.github.com/users/DougTrajano/starred{/owner}{/repo}
https://api.github.com/users/DougTrajano/subscriptions
User
https://api.github.com/users/DougTrajano
public
MEMBER
AFAIK `shutil.move` does call `os.rename` first before doing extra work to make it work on windows, so this is should be a safe safe change for linux ;)
2022-08-22T16:46:49Z
https://github.com/huggingface/datasets/pull/4825#issuecomment-1222625280
https://api.github.com/repos/huggingface/datasets/issues/4825
IC_kwDODunzps5I38gA
https://api.github.com/repos/huggingface/datasets/issues/comments/1222625280/reactions
2022-08-22T16:47:02Z
https://api.github.com/repos/huggingface/datasets/issues/comments/1222625280
https://avatars.githubusercontent.com/u/42851186?v=4
https://api.github.com/users/lhoestq/events{/privacy}
https://api.github.com/users/lhoestq/followers
https://api.github.com/users/lhoestq/following{/other_user}
https://api.github.com/users/lhoestq/gists{/gist_id}
https://github.com/lhoestq
lhoestq
MDQ6VXNlcjQyODUxMTg2
https://api.github.com/users/lhoestq/orgs
https://api.github.com/users/lhoestq/received_events
https://api.github.com/users/lhoestq/repos
https://api.github.com/users/lhoestq/starred{/owner}{/repo}
https://api.github.com/users/lhoestq/subscriptions
User
https://api.github.com/users/lhoestq
public
CONTRIBUTOR
> AFAIK `shutil.move` does call `os.rename` first before doing extra work to make it work on windows, so this is should be a safe safe change for linux ;)

alright, let me change the PR then.
2022-08-22T17:29:10Z
https://github.com/huggingface/datasets/pull/4825#issuecomment-1222673763
https://api.github.com/repos/huggingface/datasets/issues/4825
IC_kwDODunzps5I4IVj
https://api.github.com/repos/huggingface/datasets/issues/comments/1222673763/reactions
2022-08-22T17:29:10Z
https://api.github.com/repos/huggingface/datasets/issues/comments/1222673763
https://avatars.githubusercontent.com/u/8703022?v=4
https://api.github.com/users/DougTrajano/events{/privacy}
https://api.github.com/users/DougTrajano/followers
https://api.github.com/users/DougTrajano/following{/other_user}
https://api.github.com/users/DougTrajano/gists{/gist_id}
https://github.com/DougTrajano
DougTrajano
MDQ6VXNlcjg3MDMwMjI=
https://api.github.com/users/DougTrajano/orgs
https://api.github.com/users/DougTrajano/received_events
https://api.github.com/users/DougTrajano/repos
https://api.github.com/users/DougTrajano/starred{/owner}{/repo}
https://api.github.com/users/DougTrajano/subscriptions
User
https://api.github.com/users/DougTrajano
public
NONE
The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/datasets/pr_4825). All of your documentation changes will be reflected on that endpoint.
2022-08-23T16:57:44Z
https://github.com/huggingface/datasets/pull/4825#issuecomment-1224347726
https://api.github.com/repos/huggingface/datasets/issues/4825
IC_kwDODunzps5I-hBO
https://api.github.com/repos/huggingface/datasets/issues/comments/1224347726/reactions
2022-08-23T16:57:44Z
https://api.github.com/repos/huggingface/datasets/issues/comments/1224347726
https://avatars.githubusercontent.com/u/99929124?v=4
https://api.github.com/users/HuggingFaceDocBuilderDev/events{/privacy}
https://api.github.com/users/HuggingFaceDocBuilderDev/followers
https://api.github.com/users/HuggingFaceDocBuilderDev/following{/other_user}
https://api.github.com/users/HuggingFaceDocBuilderDev/gists{/gist_id}
https://github.com/HuggingFaceDocBuilderDev
HuggingFaceDocBuilderDev
U_kgDOBfTMJA
https://api.github.com/users/HuggingFaceDocBuilderDev/orgs
https://api.github.com/users/HuggingFaceDocBuilderDev/received_events
https://api.github.com/users/HuggingFaceDocBuilderDev/repos
https://api.github.com/users/HuggingFaceDocBuilderDev/starred{/owner}{/repo}
https://api.github.com/users/HuggingFaceDocBuilderDev/subscriptions
User
https://api.github.com/users/HuggingFaceDocBuilderDev
public
CONTRIBUTOR
Hi @lhoestq looks like one of the tests failed, but is not related to this change, do I need to do something from my side?
2022-08-23T19:35:14Z
https://github.com/huggingface/datasets/pull/4825#issuecomment-1224713689
https://api.github.com/repos/huggingface/datasets/issues/4825
IC_kwDODunzps5I_6XZ
https://api.github.com/repos/huggingface/datasets/issues/comments/1224713689/reactions
2022-08-23T19:35:14Z
https://api.github.com/repos/huggingface/datasets/issues/comments/1224713689
https://avatars.githubusercontent.com/u/8703022?v=4
https://api.github.com/users/DougTrajano/events{/privacy}
https://api.github.com/users/DougTrajano/followers
https://api.github.com/users/DougTrajano/following{/other_user}
https://api.github.com/users/DougTrajano/gists{/gist_id}
https://github.com/DougTrajano
DougTrajano
MDQ6VXNlcjg3MDMwMjI=
https://api.github.com/users/DougTrajano/orgs
https://api.github.com/users/DougTrajano/received_events
https://api.github.com/users/DougTrajano/repos
https://api.github.com/users/DougTrajano/starred{/owner}{/repo}
https://api.github.com/users/DougTrajano/subscriptions
User
https://api.github.com/users/DougTrajano
public
In this PR, we are including an additional step when `os.rename()` raises a PermissionError.

Basically, we will use `shutil.move()` on the temp files.

Fix #2937 