Avoid splitting by` .py` for the file.
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.
