From c7c6b4eaaa8e59a94f4e08a75742012395f89b48 Mon Sep 17 00:00:00 2001 From: Eric Zhu Date: Thu, 4 Jan 2024 14:11:37 -0800 Subject: [PATCH] check if docker is installed if user_docker is True --- autogen/code_utils.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/autogen/code_utils.py b/autogen/code_utils.py index dbb8637162d..299a39fba9d 100644 --- a/autogen/code_utils.py +++ b/autogen/code_utils.py @@ -272,6 +272,11 @@ def execute_code( logger.error(error_msg) raise AssertionError(error_msg) + if use_docker and docker is None: + error_msg = "Cannot use docker because the python docker package is not available." + logger.error(error_msg) + raise AssertionError(error_msg) + # Warn if use_docker was unspecified (or None), and cannot be provided (the default). # In this case the current behavior is to fall back to run natively, but this behavior # is subject to change.