From 196e215133c069f411f241320a7090bc6e032d29 Mon Sep 17 00:00:00 2001 From: vangef Date: Fri, 8 Dec 2023 14:02:44 +0000 Subject: [PATCH] extra check for comment existence --- utils/organiser.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/utils/organiser.py b/utils/organiser.py index f505446..7b19b11 100644 --- a/utils/organiser.py +++ b/utils/organiser.py @@ -25,9 +25,10 @@ def get_comment_from_submission_txt(file_path: str) -> str | None: if not no_comment_regex_compile.findall(file_contents): regular_expression = f'Comments:\n.*' regex_compile = re.compile(regular_expression) - match = regex_compile.findall(file_contents)[0] - comment = match.split('\n')[1] - return comment + if regex_compile.findall(file_contents): + match = regex_compile.findall(file_contents)[0] + comment = match.split('\n')[1] + return comment return None