-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Misleading error messages when opening inexistent json file #29102
Comments
Hi, @datapythonista can I take this up? |
sure, thanks |
Hi! Would like to work on this if it is still open. |
take |
Hey @sathyz if you don't finish it by the end of the month I think I'll give it a shot. |
take |
@devjeetr Is this issue still open? Can I give a shot? |
Hi, I would like to to take this issue if it's still not resolved. |
take |
Anyone willing to take this up might want to go through this thread once. |
Would a PR for this still be welcomed? Reading #29104 makes it sounds like the conclusion there was no good solution exists but tbh I don't understand why not. |
If I've understood the discussion correctly, then I think that at least for extensioned json files, it should be possible to assume user intent and raise an informative error message if the file doesn't exist |
@MarcoGorelli So if I submit a PR that raises if (
isinstance(filepath_or_buffer, str)
and filepath_or_buffer.lower().endswith(('.json', '.json.gz', '.json.bz2'))
and not isfile(filepath_or_buffer)
) that would be acceptable? Seems like a definite improvement over current behavior to me. |
When opening a json file that doesn't exist with
read_json
, we get aValueError
with error messages like:It'd probably be better to raise an exception like:
The text was updated successfully, but these errors were encountered: