From 28780d988a1cba57a882e978794122f4cc7efa9e Mon Sep 17 00:00:00 2001 From: Varsha Menon Date: Fri, 29 Mar 2024 11:27:18 -0400 Subject: [PATCH] fix: csv read --- .../apps/core/management/commands/bulk_add_course_staff.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/edx_exams/apps/core/management/commands/bulk_add_course_staff.py b/edx_exams/apps/core/management/commands/bulk_add_course_staff.py index 8307c74c..c369687a 100644 --- a/edx_exams/apps/core/management/commands/bulk_add_course_staff.py +++ b/edx_exams/apps/core/management/commands/bulk_add_course_staff.py @@ -58,7 +58,7 @@ def handle(self, *args, **options): # self.add_course_staff_from_csv(csv_file, batch_size, batch_delay) # if csv_path: - with open(csv_path) as csv_file: + with open(csv_path, 'r') as csv_file: self.add_course_staff_from_csv(csv_file, batch_size, batch_delay) logger.info('Bulk add course staff complete!') @@ -67,7 +67,7 @@ def add_course_staff_from_csv(self, csv_file, batch_size, batch_delay): """ Add the given set of course staff provided in csv """ - reader = list(csv.DictReader(csv_file)) + reader = csv.DictReader(csv_file) users_to_create = [] users_existing = {u.username for u in User.objects.filter(username__in=[r.get('username') for r in reader])} for row in reader: