polars icon indicating copy to clipboard operation
polars copied to clipboard

JSON Error should also report line

Open baggiponte opened this issue 1 year ago • 2 comments

Description

Ciao! I was trying to read_json a file and got this error:

image

The issue is due to malformed JSON.

pandas has an uninformative error as well:

image

The better error message is that of python's native reader:

image

baggiponte avatar Mar 19 '24 15:03 baggiponte

Pandas doesn't run in parallel. So it can (easily) keep a line counter. This error could be in a chunk later in the file when we don't know how large the previous chunks will be.

ritchie46 avatar Mar 20 '24 07:03 ritchie46

Definitely not trivial, you are right. The "char" indicator denotes the character position in the line then, rather than the position in the whole file?

baggiponte avatar Mar 20 '24 10:03 baggiponte