Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions dimos/models/segmentation/edge_tam.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,14 @@ class EdgeTAMProcessor(Detector):
def __init__(
self,
) -> None:
try:
import sam2 # noqa: F401
except ImportError:
raise ImportError(
"EdgeTAM requires the 'edgetam-dimos' package (provides sam2). "
"Install with: uv sync --extra misc"
) from None
Comment on lines +62 to +66
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Using from None suppresses the original ImportError's __cause__, so if sam2 is partially installed and raises a more informative sub-error (e.g., a missing native .so), that detail is silently discarded. Keeping the cause chain lets developers distinguish "package not installed at all" from "package installed but broken", without harming the curated message.

Suggested change
except ImportError:
raise ImportError(
"EdgeTAM requires the 'edgetam-dimos' package (provides sam2). "
"Install with: uv sync --extra misc"
) from None
except ImportError as exc:
raise ImportError(
"EdgeTAM requires the 'edgetam-dimos' package (provides sam2). "
"Install with: uv sync --extra misc"
) from exc


local_config_path = Path(__file__).parent / "configs" / "edgetam.yaml"

if not local_config_path.exists():
Expand Down
Loading