Better error diagnostics and fix parsing errors.csv

This commit is contained in:
Lonami Exo
2019-01-24 11:02:58 +01:00
parent d1fee27814
commit 86a8928278
2 changed files with 8 additions and 2 deletions

View File

@@ -60,7 +60,13 @@ def parse_errors(csv_file):
with csv_file.open(newline='') as f:
f = csv.reader(f)
next(f, None) # header
for line, (name, codes, description) in enumerate(f, start=2):
for line, tup in enumerate(f, start=2):
try:
name, codes, description = tup
except ValueError:
raise ValueError('Columns count mismatch, unquoted comma in '
'desc? (line {})'.format(line)) from None
try:
codes = [int(x) for x in codes.split()] or [400]
except ValueError: