From ab6911639c0d4c2d4e15cb70a2888c2cbf5596e5 Mon Sep 17 00:00:00 2001 From: Kye Date: Wed, 12 Jul 2023 19:46:22 -0400 Subject: [PATCH] playground Former-commit-id: b733e2a6a6f88b1924888530f63b4031f6eb0af1 --- swarms/agents/workers/WorkerUltraNode.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/swarms/agents/workers/WorkerUltraNode.py b/swarms/agents/workers/WorkerUltraNode.py index 6af14eef..0e8da00f 100644 --- a/swarms/agents/workers/WorkerUltraNode.py +++ b/swarms/agents/workers/WorkerUltraNode.py @@ -16,10 +16,18 @@ from swarms.utils.main import StaticUploader logging.basicConfig(level=logging.DEBUG, format='%(asctime)s - %(levelname)s - %(message)s') BASE_DIR = Path(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) -playground = os.environ["PLAYGROUND_DIR"] = '/path/to/directory' -os.chdir(BASE_DIR / playground) +# Check if "PLAYGROUND_DIR" environment variable exists, if not, set a default value +playground = os.environ.get("PLAYGROUND_DIR", './playground') +# Ensure the path exists before changing the directory +os.makedirs(BASE_DIR / playground, exist_ok=True) + +try: + os.chdir(BASE_DIR / playground) +except Exception as e: + logging.error(f"Failed to change directory: {e}") + class WorkerUltraNode: def __init__(self, objective: str): if not isinstance(objective, str):