From 31e235490c8a03b7ccbb66ef6d0c50c7736a1b9f Mon Sep 17 00:00:00 2001 From: Russell Bryant Date: Sat, 28 Sep 2024 23:39:01 +0000 Subject: [PATCH] Fix TypeError when CONDA_PREFIX is not set I ran a build with the mode set to `conda` by accident and did not have the `CONDA_PREFIX` env var set. In that case, `os.getenv` returns `None`, and passing `None` to create an `os.Path` is not valid. It will raise a `TypeError`. > TypeError: expected str, bytes or os.PathLike object, not NoneType Signed-off-by: Russell Bryant --- llama_stack/cli/stack/build.py | 2 +- llama_stack/cli/stack/configure.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/llama_stack/cli/stack/build.py b/llama_stack/cli/stack/build.py index 2b5b432c8..ceed53e82 100644 --- a/llama_stack/cli/stack/build.py +++ b/llama_stack/cli/stack/build.py @@ -101,7 +101,7 @@ class StackBuild(Subcommand): ) else: build_dir = ( - Path(os.getenv("CONDA_PREFIX")).parent + Path(os.getenv("CONDA_PREFIX", "")).parent / f"llamastack-{build_config.name}" ) diff --git a/llama_stack/cli/stack/configure.py b/llama_stack/cli/stack/configure.py index 5b1fbba86..ccf0d94f0 100644 --- a/llama_stack/cli/stack/configure.py +++ b/llama_stack/cli/stack/configure.py @@ -67,7 +67,7 @@ class StackConfigure(Subcommand): ) if os.getenv("CONDA_PREFIX"): conda_dir = ( - Path(os.getenv("CONDA_PREFIX")).parent / f"llamastack-{args.config}" + Path(os.getenv("CONDA_PREFIX", "")).parent / f"llamastack-{args.config}" ) build_config_file = Path(conda_dir) / f"{args.config}-build.yaml"