Skip to content

Misleading error messages when opening inexistent json file #29102

Closed
@datapythonista

Description

@datapythonista

When opening a json file that doesn't exist with read_json, we get a ValueError with error messages like:

>>> import pandas
>>> pandas.read_json('no_file.json')
ValueError: Unexpected character found when decoding 'null'

>>> pandas.read_json('a_dir/no_file.json')
ValueError: Expected object or value

It'd probably be better to raise an exception like:

FileNotFoundError: No such file: 'no_file.json'

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions