From 79e70e9c2f73f054bc30e82ac46688cf44776edf Mon Sep 17 00:00:00 2001 From: haosenwang1018 Date: Tue, 24 Feb 2026 21:42:41 +0000 Subject: [PATCH] fix: remove duplicate output_fp.close() call in evaluation runner output_fp is opened at line 153 and closed in the finally block (line 261). However, there is a second output_fp.close() call at line 266 outside the try/finally, which raises ValueError('I/O operation on closed file') when execution reaches it after the finally block runs. Remove the redundant close() call since the finally block already guarantees proper cleanup. --- evaluation/utils.py | 1 - 1 file changed, 1 deletion(-) diff --git a/evaluation/utils.py b/evaluation/utils.py index 398fc85..a9d4499 100644 --- a/evaluation/utils.py +++ b/evaluation/utils.py @@ -263,7 +263,6 @@ def run_evaluation( results_queue.close() results_queue.join_thread() - output_fp.close() logger.info('\nEvaluation finished.\n') def _process_instance_wrapper_mp(args): """Wrapper for multiprocessing, especially for imap_unordered."""