Avoid splitting by` .py` for the file.
MEMBER
Hi @espoirMur, thanks for reporting.

You are right: that code line could be improved and made more generically valid.

On the other hand, I would suggest using `os.path.splitext` instead.

Are you willing to open a PR? :)
2022-06-23T07:51:33Z
https://github.com/huggingface/datasets/issues/4540#issuecomment-1164074696
https://api.github.com/repos/huggingface/datasets/issues/4540
IC_kwDODunzps5FYl7I
https://api.github.com/repos/huggingface/datasets/issues/comments/1164074696/reactions
2022-06-23T07:51:33Z
https://api.github.com/repos/huggingface/datasets/issues/comments/1164074696
https://avatars.githubusercontent.com/u/8515462?v=4
https://api.github.com/users/albertvillanova/events{/privacy}
https://api.github.com/users/albertvillanova/followers
https://api.github.com/users/albertvillanova/following{/other_user}
https://api.github.com/users/albertvillanova/gists{/gist_id}
https://github.com/albertvillanova
albertvillanova
MDQ6VXNlcjg1MTU0NjI=
https://api.github.com/users/albertvillanova/orgs
https://api.github.com/users/albertvillanova/received_events
https://api.github.com/users/albertvillanova/repos
https://api.github.com/users/albertvillanova/starred{/owner}{/repo}
https://api.github.com/users/albertvillanova/subscriptions
User
https://api.github.com/users/albertvillanova
public
NONE
I will have a look.. 

This weekend .. 
2022-06-25T06:34:18Z
https://github.com/huggingface/datasets/issues/4540#issuecomment-1166204678
https://api.github.com/repos/huggingface/datasets/issues/4540
IC_kwDODunzps5Fgt8G
https://api.github.com/repos/huggingface/datasets/issues/comments/1166204678/reactions
2022-06-25T06:34:39Z
https://api.github.com/repos/huggingface/datasets/issues/comments/1166204678
https://avatars.githubusercontent.com/u/18573157?v=4
https://api.github.com/users/espoirMur/events{/privacy}
https://api.github.com/users/espoirMur/followers
https://api.github.com/users/espoirMur/following{/other_user}
https://api.github.com/users/espoirMur/gists{/gist_id}
https://github.com/espoirMur
espoirMur
MDQ6VXNlcjE4NTczMTU3
https://api.github.com/users/espoirMur/orgs
https://api.github.com/users/espoirMur/received_events
https://api.github.com/users/espoirMur/repos
https://api.github.com/users/espoirMur/starred{/owner}{/repo}
https://api.github.com/users/espoirMur/subscriptions
User
https://api.github.com/users/espoirMur
public
CONTRIBUTOR
@albertvillanova  , Can you have a look at #4590. 

Thanks 
2022-06-28T21:48:56Z
https://github.com/huggingface/datasets/issues/4540#issuecomment-1169313950
https://api.github.com/repos/huggingface/datasets/issues/4540
IC_kwDODunzps5FslCe
https://api.github.com/repos/huggingface/datasets/issues/comments/1169313950/reactions
2022-06-28T21:48:56Z
https://api.github.com/repos/huggingface/datasets/issues/comments/1169313950
https://avatars.githubusercontent.com/u/20517962?v=4
https://api.github.com/users/VijayKalmath/events{/privacy}
https://api.github.com/users/VijayKalmath/followers
https://api.github.com/users/VijayKalmath/following{/other_user}
https://api.github.com/users/VijayKalmath/gists{/gist_id}
https://github.com/VijayKalmath
VijayKalmath
MDQ6VXNlcjIwNTE3OTYy
https://api.github.com/users/VijayKalmath/orgs
https://api.github.com/users/VijayKalmath/received_events
https://api.github.com/users/VijayKalmath/repos
https://api.github.com/users/VijayKalmath/starred{/owner}{/repo}
https://api.github.com/users/VijayKalmath/subscriptions
User
https://api.github.com/users/VijayKalmath
public
CONTRIBUTOR
#self-assign
2022-06-28T22:36:38Z
https://github.com/huggingface/datasets/issues/4540#issuecomment-1169357591
https://api.github.com/repos/huggingface/datasets/issues/4540
IC_kwDODunzps5FsvsX
https://api.github.com/repos/huggingface/datasets/issues/comments/1169357591/reactions
2022-06-28T22:36:38Z
https://api.github.com/repos/huggingface/datasets/issues/comments/1169357591
https://avatars.githubusercontent.com/u/20517962?v=4
https://api.github.com/users/VijayKalmath/events{/privacy}
https://api.github.com/users/VijayKalmath/followers
https://api.github.com/users/VijayKalmath/following{/other_user}
https://api.github.com/users/VijayKalmath/gists{/gist_id}
https://github.com/VijayKalmath
VijayKalmath
MDQ6VXNlcjIwNTE3OTYy
https://api.github.com/users/VijayKalmath/orgs
https://api.github.com/users/VijayKalmath/received_events
https://api.github.com/users/VijayKalmath/repos
https://api.github.com/users/VijayKalmath/starred{/owner}{/repo}
https://api.github.com/users/VijayKalmath/subscriptions
User
https://api.github.com/users/VijayKalmath
public
https://github.com/huggingface/datasets/blob/90b3a98065556fc66380cafd780af9b1814b9426/src/datasets/load.py#L272


Hello, 
Thanks you for this library . 

 I was using it and I had one edge case. my home folder name ends with `.py` it is `/home/espoir.py` so anytime I am running the code to load a local module this code here it is failing because after splitting it is trying to save the code to my home directory.


Step to reproduce.

- If you have a home folder which ends with `.py`

- load a module with a local folder 
`qa_dataset = load_dataset("src/data/build_qa_dataset.py")`
it is failed 
A possible workaround would be to use pathlib at the mentioned line

` meta_path = Path(importable_local_file).parent.joinpath("metadata.json")` this can alivate the issue .

Let me what are your thought on this and I can try to fix it by A PR.
