From ff8a3dee76bbed9e50b6246d872663a5b459a655 Mon Sep 17 00:00:00 2001 From: Turgut Date: Thu, 21 May 2026 16:03:06 +0200 Subject: [PATCH] fix: close annotation file handle via context manager --- roboflow/core/project.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roboflow/core/project.py b/roboflow/core/project.py index 05b1c773..c53872c9 100644 --- a/roboflow/core/project.py +++ b/roboflow/core/project.py @@ -638,8 +638,8 @@ def _annotation_params(self, annotation_path): annotation_name = annotation_path["name"] annotation_string = annotation_path["rawText"] elif os.path.exists(annotation_path): # type: ignore[arg-type] - with open(annotation_path): # type: ignore[arg-type] - annotation_string = open(annotation_path).read() # type: ignore[arg-type] + with open(annotation_path) as f: # type: ignore[arg-type] + annotation_string = f.read() # type: ignore[arg-type] annotation_name = os.path.basename(annotation_path) # type: ignore[arg-type] elif self.type == "classification": print(f"-> using {annotation_path} as classname for classification project")