From e40d1a86a28e4e3959fa0b28d8e0c4e552da3bd8 Mon Sep 17 00:00:00 2001 From: Arpan Tripathi <42506819+tripathiarpan20@users.noreply.github.com> Date: Tue, 11 Jun 2024 02:36:24 +0100 Subject: [PATCH] fix: `FileExistsError: [Errno 17] File exists: '/root/bentoml'` (#4781) Update __init__.py --- src/bentoml/_internal/utils/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bentoml/_internal/utils/__init__.py b/src/bentoml/_internal/utils/__init__.py index 2d4fb61182c..7cc62ceee85 100644 --- a/src/bentoml/_internal/utils/__init__.py +++ b/src/bentoml/_internal/utils/__init__.py @@ -147,7 +147,7 @@ def validate_or_create_dir(*path: PathType) -> None: if not path_obj.is_dir(): raise OSError(20, f"{path_obj} is not a directory") else: - path_obj.mkdir(parents=True) + path_obj.mkdir(parents=True, exist_ok=True) def calc_dir_size(path: PathType) -> int: