Fix empty cache dir
CONTRIBUTOR
Looks great! Will this change force all cached datasets to be redownloaded? But even if it does, it shoud not be a big problem, I think
2020-06-05T19:04:32Z
https://github.com/huggingface/datasets/pull/241#issuecomment-639723231
https://api.github.com/repos/huggingface/datasets/issues/241
MDEyOklzc3VlQ29tbWVudDYzOTcyMzIzMQ==
https://api.github.com/repos/huggingface/datasets/issues/comments/639723231/reactions
2020-06-05T19:04:32Z
https://api.github.com/repos/huggingface/datasets/issues/comments/639723231
https://avatars.githubusercontent.com/u/23423619?v=4
https://api.github.com/users/patrickvonplaten/events{/privacy}
https://api.github.com/users/patrickvonplaten/followers
https://api.github.com/users/patrickvonplaten/following{/other_user}
https://api.github.com/users/patrickvonplaten/gists{/gist_id}
https://github.com/patrickvonplaten
patrickvonplaten
MDQ6VXNlcjIzNDIzNjE5
https://api.github.com/users/patrickvonplaten/orgs
https://api.github.com/users/patrickvonplaten/received_events
https://api.github.com/users/patrickvonplaten/repos
https://api.github.com/users/patrickvonplaten/starred{/owner}{/repo}
https://api.github.com/users/patrickvonplaten/subscriptions
User
https://api.github.com/users/patrickvonplaten
public
MEMBER
> Looks great! Will this change force all cached datasets to be redownloaded? But even if it does, it shoud not be a big problem, I think

No it shouldn't force to redownload
2020-06-08T08:26:44Z
https://github.com/huggingface/datasets/pull/241#issuecomment-640450731
https://api.github.com/repos/huggingface/datasets/issues/241
MDEyOklzc3VlQ29tbWVudDY0MDQ1MDczMQ==
https://api.github.com/repos/huggingface/datasets/issues/comments/640450731/reactions
2020-06-08T08:29:44Z
https://api.github.com/repos/huggingface/datasets/issues/comments/640450731
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
If the cache dir of a dataset is empty, the dataset fails to load and throws a FileNotFounfError. We could end up with empty cache dir because there was a line in the code that created the cache dir without using a temp dir. Using a temp dir is useful as it gets renamed to the real cache dir only if the full process is successful.

So I removed this bad line, and I also reordered things a bit to make sure that we always use a temp dir. I also added warning if we still end up with empty cache dirs in the future.

This should fix #239
