diff --git a/evap/staff/views.py b/evap/staff/views.py index dc45d0ccf5..b3ce894cc4 100644 --- a/evap/staff/views.py +++ b/evap/staff/views.py @@ -1,4 +1,3 @@ -import codecs import csv import itertools from collections import OrderedDict, defaultdict, namedtuple @@ -2130,6 +2129,7 @@ def user_export(request): writer.writerows( (user.title, user.last_name, user.first_name, user.email) for user in UserProfile.objects.iterator() ) + return response @manager_required diff --git a/tools/enrollment_preprocessor.py b/tools/enrollment_preprocessor.py index 05ecb533cc..a157d1e4ec 100755 --- a/tools/enrollment_preprocessor.py +++ b/tools/enrollment_preprocessor.py @@ -74,7 +74,7 @@ def run_preprocessor(enrollment_data: str | BytesIO, user_data: TextIO) -> Bytes fix_user(users, UserCells(*wb_row[7:])) wb_out = BytesIO() workbook.save(wb_out) - wb.seek(0) + wb_out.seek(0) return wb_out @@ -83,7 +83,7 @@ def run_preprocessor(enrollment_data: str | BytesIO, user_data: TextIO) -> Bytes parser.add_argument("user-data", help="Path to a csv file containing an export of all existing users.") parser.add_argument("enrollment-data", help="Path to the enrollment data in xlsx format for import.") ns = parser.parse_args() - with open(ns.user_data) as csvfile: + with open(ns.user_data, encoding="utf-8") as csvfile: wb = run_preprocessor(ns.enrollment_data, csvfile) with open(ns.enrollment_data, "wb") as out: out.write(wb.read())