Claude Code Claude Opus 4.6 commited on
Commit
bf46867
·
1 Parent(s): 30ce3dc

Claude Code: Fix import path resolution in error_handlers.py for Docker runtime

Browse files

Fix import error for agents.brain_minimal by explicitly adding
/app/openclaw/.openclaw to sys.path before importing agents module.
This ensures the brain module can be found in Docker WORKDIR /app.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Files changed (1) hide show
  1. error_handlers.py +6 -0
error_handlers.py CHANGED
@@ -150,6 +150,12 @@ def handle_brain_response(message: str) -> str:
150
  try:
151
  # Import openclaw first to set up sys.path, then import agents
152
  import openclaw
 
 
 
 
 
 
153
  from agents import brain_minimal
154
 
155
  brain = brain_minimal.get_brain(agent_name="cain", legacy_mode=True)
 
150
  try:
151
  # Import openclaw first to set up sys.path, then import agents
152
  import openclaw
153
+ # Ensure .openclaw path is added for agents import
154
+ import sys
155
+ from pathlib import Path
156
+ _openclaw_internal = Path(__file__).parent / "openclaw" / ".openclaw"
157
+ if str(_openclaw_internal) not in sys.path:
158
+ sys.path.insert(0, str(_openclaw_internal))
159
  from agents import brain_minimal
160
 
161
  brain = brain_minimal.get_brain(agent_name="cain", legacy_mode=True)