mirror of
https://github.com/ilri/csv-metadata-quality.git
synced 2025-05-11 07:36:01 +02:00
Don't crash when title is missing
We shouldn't crash the country/region checker/fixer when the title field is missing, since we only use it to show status to the user.
This commit is contained in:
@ -563,8 +563,13 @@ def countries_match_regions(row, exclude):
|
||||
un_region = cc.convert(names=country, to="UNRegion")
|
||||
|
||||
if un_region != "not found" and un_region not in regions:
|
||||
print(
|
||||
f"{Fore.YELLOW}Missing region ({country} → {un_region}): {Fore.RESET}{row[title_column_name]}"
|
||||
)
|
||||
try:
|
||||
print(
|
||||
f"{Fore.YELLOW}Missing region ({country} → {un_region}): {Fore.RESET}{row[title_column_name]}"
|
||||
)
|
||||
except KeyError:
|
||||
print(
|
||||
f"{Fore.YELLOW}Missing region ({country} → {un_region}): {Fore.RESET}<title field not present>"
|
||||
)
|
||||
|
||||
return
|
||||
|
Reference in New Issue
Block a user