Closed sturmi closed 1 year ago
So you had to swap around the try and exception lines? Wonder why that fixed i it. Can you paste the error you were receiving? I wonder if there's an additional key value that wasn't in my json it wasn't handling. if you'd like to raise a pull request feel free. Glad this helped you out
So you had to swap around the try and exception lines? Wonder why that fixed i it. Can you paste the error you were receiving? I wonder if there's an additional key value that wasn't in my json it wasn't handling. if you'd like to raise a pull request feel free. Glad this helped you out
Hi,
this is the full error message I received:
`$ python semantic_location_parser_org.py
Traceback (most recent call last):
File "/home/ts/RTS/googledata/semantic_location_parser_org.py", line 47, in
The csv file is filled correctly until the error `appears. I have 20 YYYY_MONTH.json files. 17 will be parsed correctly. Only with 3 of them I got the error. So I decided to add the exception handler for "address"
Hi, thank you for your script. It is exactly what I needed :-) I got exception parsing some YYYY_MONTH.json files: ` File "/home/ts/RTS/googledata/semantic_location_parser.py", line 18, in process_file address = obj['placeVisit']['location']['address'] KeyError: 'address'
So I added this
to semantic_location_parser.py in line 15:
try: address = obj['placeVisit']['location']['address'] except KeyError: address = obj['placeVisit']['location']['name']`regards Thomas