pyfil
pyfil copied to clipboard
no way to skip/handle JSONDecodeError
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.
Yeah, that's not good. I'll add this to the list of things to fix!