From 2542880de09e429e92fa2df574dd8d00d56a9b9e Mon Sep 17 00:00:00 2001 From: Guilhem Moulin Date: Thu, 23 Nov 2023 12:07:52 +0100 Subject: list-observations: Don't choke on missing vernacularName or reporter/observer. --- list-observations | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/list-observations b/list-observations index 869e307..5064478 100755 --- a/list-observations +++ b/list-observations @@ -224,7 +224,8 @@ def printObservation(feature): vernacularName = properties.get('VernacularName') if vernacularName is None: - raise Exception('Missing name') + pass + #raise Exception('Missing name') if args.taxon is not None: name = vernacularName.lower() if not any([sub in name for sub in args.taxon]): @@ -293,7 +294,8 @@ def printObservation(feature): if sum_count > 0: print('') - print(f'Artnamn: {vernacularName.title()}') + if vernacularName is not None: + print(f'Artnamn: {vernacularName.title()}') name = vernacularName if taxonIsRedlisted is not None and taxonIsRedlisted and redlistCategory is not None: @@ -327,11 +329,11 @@ def printObservation(feature): if v is not None: print(f'Metod: {v}') - if ',' in reportedBy: + if reportedBy is not None and ',' in reportedBy: print(f'Rapportörer: {reportedBy}') else: print(f'Rapportör: {reportedBy}') - if ',' in recordedBy: + if recordedBy is not None and ',' in recordedBy: print(f'Observatörer: {recordedBy}') else: print(f'Observatör: {recordedBy}') -- cgit v1.2.3