You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Better error message for non-existing dataset #1111
When you call datasets.get_dataset(did) with an invalid ID, you get a rather obscure FileNotFound Error, even though the server returns an 'Unknown dataset' error.
Steps/Code to Reproduce
Expected Results
A 'Dataset does not exist' exception
Actual Results
---------------------------------------------------------------------------
FileNotFoundError Traceback (most recent call last)
/usr/local/lib/python3.7/dist-packages/openml/datasets/functions.py in _get_dataset_description(did_cache_dir, dataset_id)
948 try:
--> 949 with io.open(description_file, encoding="utf8") as fh:
950 dataset_xml = fh.read()
FileNotFoundError: [Errno 2] No such file or directory: '/root/.cache/openml/org/openml/www/datasets/987987987/description.xml'
During handling of the above exception, another exception occurred:
OpenMLServerException Traceback (most recent call last)
7 frames
/usr/local/lib/python3.7/dist-packages/openml/_api_calls.py in __check_response(response, url, file_elements)
282 def __check_response(response, url, file_elements):
283 if response.status_code != 200:
--> 284 raise __parse_server_exception(response, url, file_elements=file_elements)
285 elif (
286 "Content-Encoding" not in response.headers or response.headers["Content-Encoding"] != "gzip"
OpenMLServerException: https://www.openml.org/api/v1/xml/data/987987987 returned code 111: Unknown dataset - None
I looked into this and as seen in the error above, the return code is 111 which stands for "Revalidation failed", this seems a bit odd and strikes me as something that should be a 404. I assume this is a server side issue for which I can't do much about.
In them meantime, I can implement a hack that looks for error code 111 and "Unknown dataset - None" and convert it to something more appropriate.
Yes, that's correct. The error code itself isn't so much the problem it's just that getting a whole stacktrace for something that we reasonably can expect a user to do (even if on accident) is not great. We just want a clean error that says "This dataset does not exist (anymore)." or something similar, I think.
Activity
eddiebergman commentedon Oct 14, 2024
I looked into this and as seen in the error above, the return code is
111which stands for "Revalidation failed", this seems a bit odd and strikes me as something that should be a404. I assume this is a server side issue for which I can't do much about.In them meantime, I can implement a hack that looks for error code
111and "Unknown dataset - None" and convert it to something more appropriate.eddiebergman commentedon Oct 14, 2024
Turns out this return code is not actually a HTTP error code and a custom set of codes as found here: https://github.com/openml/OpenML/blob/9a652179fc95392559222bb99769e82bdf8e91b8/openml_OS/views/pages/api_new/v1/xml/pre.php#L13-L17
PGijsbers commentedon Oct 14, 2024
Yes, that's correct. The error code itself isn't so much the problem it's just that getting a whole stacktrace for something that we reasonably can expect a user to do (even if on accident) is not great. We just want a clean error that says "This dataset does not exist (anymore)." or something similar, I think.
eddiebergman commentedon Oct 14, 2024
Closed with #1356