fix: 🐛 be more specific when catching exceptions
MEMBER
To give more context: after our discussion, if I understood properly, you are trying to fix a call to `datasets` that takes 15 minutes: https://github.com/huggingface/datasets-preview-backend/issues/17 Is this right?


2021-09-01T13:04:17Z
https://github.com/huggingface/datasets/pull/2861#issuecomment-910264244
https://api.github.com/repos/huggingface/datasets/issues/2861
IC_kwDODunzps42QYe0
https://api.github.com/repos/huggingface/datasets/issues/comments/910264244/reactions
2021-09-01T13:04:17Z
https://api.github.com/repos/huggingface/datasets/issues/comments/910264244
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
COLLABORATOR
Yes, that's it. And to do that I'm trying to use https://pypi.org/project/stopit/, which will raise a stopit.TimeoutException exception. But currently, if this exception is raised, it's caught and considered as a "FileNotFoundError" while it should not be caught. 
2021-09-01T13:10:27Z
https://github.com/huggingface/datasets/pull/2861#issuecomment-910270360
https://api.github.com/repos/huggingface/datasets/issues/2861
IC_kwDODunzps42QZ-Y
https://api.github.com/repos/huggingface/datasets/issues/comments/910270360/reactions
2021-09-01T13:10:27Z
https://api.github.com/repos/huggingface/datasets/issues/comments/910270360
https://avatars.githubusercontent.com/u/1676121?v=4
https://api.github.com/users/severo/events{/privacy}
https://api.github.com/users/severo/followers
https://api.github.com/users/severo/following{/other_user}
https://api.github.com/users/severo/gists{/gist_id}
https://github.com/severo
severo
MDQ6VXNlcjE2NzYxMjE=
https://api.github.com/users/severo/orgs
https://api.github.com/users/severo/received_events
https://api.github.com/users/severo/repos
https://api.github.com/users/severo/starred{/owner}{/repo}
https://api.github.com/users/severo/subscriptions
User
https://api.github.com/users/severo
public
MEMBER
And what about passing the `timeout` parameter instead?
2021-09-01T13:21:55Z
https://github.com/huggingface/datasets/pull/2861#issuecomment-910280792
https://api.github.com/repos/huggingface/datasets/issues/2861
IC_kwDODunzps42QchY
https://api.github.com/repos/huggingface/datasets/issues/comments/910280792/reactions
2021-09-01T13:21:55Z
https://api.github.com/repos/huggingface/datasets/issues/comments/910280792
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
COLLABORATOR
It might be a good idea, but I would have to add a timeout argument to several methods, I'm not sure we want that (I want to ensure all my queries in https://github.com/huggingface/datasets-preview-backend/tree/master/src/datasets_preview_backend/queries resolve in a given time, be it with an error in case of timeout, or with the successful response). The methods are `prepare_module`, `import_main_class`, *builder_cls.*`get_all_exported_dataset_infos`, `load_dataset_builder`, and `load_dataset`
2021-09-01T13:29:46Z
https://github.com/huggingface/datasets/pull/2861#issuecomment-910287527
https://api.github.com/repos/huggingface/datasets/issues/2861
IC_kwDODunzps42QeKn
https://api.github.com/repos/huggingface/datasets/issues/comments/910287527/reactions
2021-09-01T13:29:46Z
https://api.github.com/repos/huggingface/datasets/issues/comments/910287527
https://avatars.githubusercontent.com/u/1676121?v=4
https://api.github.com/users/severo/events{/privacy}
https://api.github.com/users/severo/followers
https://api.github.com/users/severo/following{/other_user}
https://api.github.com/users/severo/gists{/gist_id}
https://github.com/severo
severo
MDQ6VXNlcjE2NzYxMjE=
https://api.github.com/users/severo/orgs
https://api.github.com/users/severo/received_events
https://api.github.com/users/severo/repos
https://api.github.com/users/severo/starred{/owner}{/repo}
https://api.github.com/users/severo/subscriptions
User
https://api.github.com/users/severo
public
MEMBER
I understand, you are trying to find a fix for your use case. OK.

Just note that it is also an issue for `datasets` users. Once #2859 fixed in `datasets`, you will no longer have this issue...
2021-09-01T13:36:55Z
https://github.com/huggingface/datasets/pull/2861#issuecomment-910293538
https://api.github.com/repos/huggingface/datasets/issues/2861
IC_kwDODunzps42Qfoi
https://api.github.com/repos/huggingface/datasets/issues/comments/910293538/reactions
2021-09-01T13:36:55Z
https://api.github.com/repos/huggingface/datasets/issues/comments/910293538
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
COLLABORATOR
Closing, since 1. my problem is more #2859, and I was asking for that change in order to make a hack work on my side, 2. if we want to change how exceptions are handled, we surely want to do it on all the codebase, not only in this particular case.
2021-09-02T09:52:03Z
https://github.com/huggingface/datasets/pull/2861#issuecomment-911473211
https://api.github.com/repos/huggingface/datasets/issues/2861
IC_kwDODunzps42U_o7
https://api.github.com/repos/huggingface/datasets/issues/comments/911473211/reactions
2021-09-02T09:52:03Z
https://api.github.com/repos/huggingface/datasets/issues/comments/911473211
https://avatars.githubusercontent.com/u/1676121?v=4
https://api.github.com/users/severo/events{/privacy}
https://api.github.com/users/severo/followers
https://api.github.com/users/severo/following{/other_user}
https://api.github.com/users/severo/gists{/gist_id}
https://github.com/severo
severo
MDQ6VXNlcjE2NzYxMjE=
https://api.github.com/users/severo/orgs
https://api.github.com/users/severo/received_events
https://api.github.com/users/severo/repos
https://api.github.com/users/severo/starred{/owner}{/repo}
https://api.github.com/users/severo/subscriptions
User
https://api.github.com/users/severo
public
The same specific exception is catched in other parts of the same
function.