-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
pd.read_json cryptic error on missing file #5655
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
Comments
error could be better, but this is legit, the user passed a non-existant file, so it must be a json-string (that cannot be parsed). |
Right, what I meant by that description is that I'm aware the behavior is by choice but wish Nevermind, that's the API, but a better error message would help. |
TLTC (too-late-too-cancel).... |
:) |
same type of error also will occur with |
Safety in numbers? Oh, yeah, better error message there too then I guess. |
haha |
Can't fix similar problem in read_msgpack because
Decodes just fine. Can't fix it in read_json either because sometimes the Exception error message Sorry, but that's a really pernicious API. |
read_json interprets strings which are not filenames as json data, then fails to parse them
if the filename names a path that doesn't exist (due to typo, or being in wrong directory for example).
That overloading makes it
impossiblenasty to distinguish two distinct error cases, e.g.missing file and malformed json. Dubious API choice to my tastes.
in any case, catch both errors and return a saner message "missing file or malformed input" etc.
The text was updated successfully, but these errors were encountered: