Avoid splitting by` .py` for the file.
{'login': 'espoirMur', 'id': 18573157, 'node_id': 'MDQ6VXNlcjE4NTczMTU3', 'avatar_url': 'https://avatars.githubusercontent.com/u/18573157?v=4', 'gravatar_id': '', 'url': 'https://api.github.com/users/espoirMur', 'html_url': 'https://github.com/espoirMur', 'followers_url': 'https://api.github.com/users/espoirMur/followers', 'following_url': 'https://api.github.com/users/espoirMur/following{/other_user}', 'gists_url': 'https://api.github.com/users/espoirMur/gists{/gist_id}', 'starred_url': 'https://api.github.com/users/espoirMur/starred{/owner}{/repo}', 'subscriptions_url': 'https://api.github.com/users/espoirMur/subscriptions', 'organizations_url': 'https://api.github.com/users/espoirMur/orgs', 'repos_url': 'https://api.github.com/users/espoirMur/repos', 'events_url': 'https://api.github.com/users/espoirMur/events{/privacy}', 'received_events_url': 'https://api.github.com/users/espoirMur/received_events', 'type': 'User', 'site_admin': False}
[{'id': 1935892877, 'node_id': 'MDU6TGFiZWwxOTM1ODkyODc3', 'url': 'https://api.github.com/repos/huggingface/datasets/labels/good%20first%20issue', 'name': 'good first issue', 'color': '7057ff', 'default': True, 'description': 'Good for newcomers'}]
{'login': 'VijayKalmath', 'id': 20517962, 'node_id': 'MDQ6VXNlcjIwNTE3OTYy', 'avatar_url': 'https://avatars.githubusercontent.com/u/20517962?v=4', 'gravatar_id': '', 'url': 'https://api.github.com/users/VijayKalmath', 'html_url': 'https://github.com/VijayKalmath', 'followers_url': 'https://api.github.com/users/VijayKalmath/followers', 'following_url': 'https://api.github.com/users/VijayKalmath/following{/other_user}', 'gists_url': 'https://api.github.com/users/VijayKalmath/gists{/gist_id}', 'starred_url': 'https://api.github.com/users/VijayKalmath/starred{/owner}{/repo}', 'subscriptions_url': 'https://api.github.com/users/VijayKalmath/subscriptions', 'organizations_url': 'https://api.github.com/users/VijayKalmath/orgs', 'repos_url': 'https://api.github.com/users/VijayKalmath/repos', 'events_url': 'https://api.github.com/users/VijayKalmath/events{/privacy}', 'received_events_url': 'https://api.github.com/users/VijayKalmath/received_events', 'type': 'User', 'site_admin': False}
[{'login': 'VijayKalmath', 'id': 20517962, 'node_id': 'MDQ6VXNlcjIwNTE3OTYy', 'avatar_url': 'https://avatars.githubusercontent.com/u/20517962?v=4', 'gravatar_id': '', 'url': 'https://api.github.com/users/VijayKalmath', 'html_url': 'https://github.com/VijayKalmath', 'followers_url': 'https://api.github.com/users/VijayKalmath/followers', 'following_url': 'https://api.github.com/users/VijayKalmath/following{/other_user}', 'gists_url': 'https://api.github.com/users/VijayKalmath/gists{/gist_id}', 'starred_url': 'https://api.github.com/users/VijayKalmath/starred{/owner}{/repo}', 'subscriptions_url': 'https://api.github.com/users/VijayKalmath/subscriptions', 'organizations_url': 'https://api.github.com/users/VijayKalmath/orgs', 'repos_url': 'https://api.github.com/users/VijayKalmath/repos', 'events_url': 'https://api.github.com/users/VijayKalmath/events{/privacy}', 'received_events_url': 'https://api.github.com/users/VijayKalmath/received_events', 'type': 'User', 'site_admin': False}]
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? :) I will have a look.. 

This weekend ..  @albertvillanova  , Can you have a look at #4590. 

Thanks  #self-assign
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.

{'url': 'https://api.github.com/repos/huggingface/datasets/issues/4540/reactions', 'total_count': 0, '+1': 0, '-1': 0, 'laugh': 0, 'hooray': 0, 'confused': 0, 'heart': 0, 'rocket': 0, 'eyes': 0}