From bf8d9c96e95b593c18d5d2b7c4511139aa917eb1 Mon Sep 17 00:00:00 2001 From: Matteo Destro Date: Sun, 13 Oct 2024 09:08:03 +0200 Subject: [PATCH] Handle OSError when checking for is_file (#215) --- clearml_agent/commands/worker.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/clearml_agent/commands/worker.py b/clearml_agent/commands/worker.py index 7073f5a..a3c012e 100644 --- a/clearml_agent/commands/worker.py +++ b/clearml_agent/commands/worker.py @@ -3198,7 +3198,11 @@ class Worker(ServiceCommandSection): execution.working_dir = execution.working_dir or "." # fix our import patch (in case we have __future__) - if script_file and script_file.is_file(): + try: + is_file = script_file and script_file.is_file() + except OSError: + is_file = False + if is_file: fix_package_import_diff_patch(script_file.as_posix()) if is_literal_script and not has_repository: