diff --git a/python/src/functions/generate_treasury_report.py b/python/src/functions/generate_treasury_report.py index ab7c7604..2f01f92d 100644 --- a/python/src/functions/generate_treasury_report.py +++ b/python/src/functions/generate_treasury_report.py @@ -229,7 +229,7 @@ def process_event(payload: ProjectLambdaPayload, logger: structlog.stdlib.BoundL file=new_output_file, ) # Output CSV file for treasury - with tempfile.NamedTemporaryFile("rb+") as csv_file: + with tempfile.NamedTemporaryFile("r+") as csv_file: convert_xlsx_to_csv(csv_file, output_workbook, highest_row_num) upload_generated_file_to_s3( client=s3_client, diff --git a/python/src/lib/workbook_utils.py b/python/src/lib/workbook_utils.py index 6aa87ab9..77143c8f 100644 --- a/python/src/lib/workbook_utils.py +++ b/python/src/lib/workbook_utils.py @@ -1,6 +1,6 @@ import csv from tempfile import _TemporaryFileWrapper -from typing import IO, Optional, Union +from typing import Optional from openpyxl import Workbook from openpyxl.worksheet.worksheet import Worksheet @@ -19,8 +19,8 @@ def escape_for_csv(text: Optional[str]): def convert_xlsx_to_csv( - csv_file: Union[IO[bytes], _TemporaryFileWrapper], - file: Union[IO[bytes], Workbook], + csv_file: "_TemporaryFileWrapper[str]", + file: Workbook, num_rows: int, ): """