pyfil icon indicating copy to clipboard operation
pyfil copied to clipboard

no way to skip/handle JSONDecodeError

Open al-zatv opened this issue 5 years ago • 1 comments
trafficstars

Hello! I have text file with jsons in every line. And I process them this way:

cat testj | pyfil -l -j 'j.texts[0].text if j.texts else None'

If one of lines contain malformed json, it terminates with json.decoder.JSONDecodeError. And there is no way to skip it. Also, I can't handle it with -S or with -H 'json.decoder.JSONDecodeError: print("ERROR to skip")'.

In my opinion, it is better if this exception will be handled uniformly with others. I mean, not to terminate script if such exception occurs, and to have an ability to handle it.

al-zatv avatar Jul 19 '20 12:07 al-zatv

Yeah, that's not good. I'll add this to the list of things to fix!

ninjaaron avatar Jul 20 '20 11:07 ninjaaron