Skip to content

Commit

Permalink
annotate_text: use same wrapper
Browse files Browse the repository at this point in the history
second wrapper was causing the first to close prior to csv.reader()
  • Loading branch information
dale-wahl committed Jan 9, 2025
1 parent f320101 commit e91e68d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion processors/machine_learning/annotate_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ def validate_query(query, request, user):
wrapped_file = io.TextIOWrapper(file, encoding=encoding)
try:
wrapped_file.seek(0)
dialect, has_header = sniff_csv_dialect(file)
dialect, has_header = sniff_csv_dialect(wrapped_file)
reader = csv.reader(wrapped_file, dialect=dialect) if not has_header else csv.DictReader(wrapped_file)
row = next(reader)
if len(list(row)) != 2:
Expand Down

0 comments on commit e91e68d

Please sign in to comment.