mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-05 02:31:47 +00:00
Add helpful ImportError messages for optional dependencies
When optional dependencies are missing, raise ImportError with installation instructions pointing to the relevant extras group (e.g. `[messaging]`, `[cli]`, `[mcp]`, etc.) instead of letting the import fail silently.
This commit is contained in:
parent
79a5f03f92
commit
2df306e6cd
9 changed files with 81 additions and 14 deletions
|
|
@ -335,10 +335,17 @@ class ProcessRegistry:
|
|||
)
|
||||
|
||||
if use_pty:
|
||||
if _IS_WINDOWS:
|
||||
from winpty import PtyProcess as _PtyProcessCls
|
||||
else:
|
||||
from ptyprocess import PtyProcess as _PtyProcessCls
|
||||
try:
|
||||
if _IS_WINDOWS:
|
||||
from winpty import PtyProcess as _PtyProcessCls
|
||||
else:
|
||||
from ptyprocess import PtyProcess as _PtyProcessCls
|
||||
except ImportError:
|
||||
pkg = "winpty" if _IS_WINDOWS else "ptyprocess"
|
||||
raise ImportError(
|
||||
f"{pkg} is required for PTY mode. "
|
||||
"Install with: pip install hermes-agent[pty]"
|
||||
) from None
|
||||
try:
|
||||
user_shell = _find_shell()
|
||||
pty_env = _sanitize_subprocess_env(os.environ, env_vars)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue