Skip to content

Commit

Permalink
Add None check for fieldnames to avoid warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
andreas-bauer committed Jul 3, 2024
1 parent 1e3d63c commit 345c5fe
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@ def create_box(row, fieldnames: list[str], reviewer_ids: set) -> str:
with open(args.comment_file, 'r', encoding='utf8') as csv_file:
reader = csv.DictReader(csv_file)

if reader.fieldnames is None:
print("Unable to detect columns in CSV file")
sys.exit()

if len(reader.fieldnames) < MIN_FIELDS:
print(
f'CSV file must have at least {MIN_FIELDS} columns but has {len(reader.fieldnames)}'
Expand Down

0 comments on commit 345c5fe

Please sign in to comment.