Claude Code Claude Opus 4.6 commited on
Commit
4ed7171
·
1 Parent(s): eaa3d52

Claude Code: Fix import paths for runtime environment

Browse files

- Fix app.py: change openclaw.openclaw.agents to agents (with import openclaw first)
- Fix error_handlers.py: add import openclaw before importing agents
- Ensures sys.path is properly set up before brain_minimal import

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

Files changed (2) hide show
  1. app.py +2 -1
  2. error_handlers.py +2 -1
app.py CHANGED
@@ -160,7 +160,8 @@ async def a2a_jsonrpc(request: Request):
160
  # Handle message/send method
161
  if method == "message/send":
162
  # Lazy load brain for processing
163
- from openclaw.openclaw.agents import brain_minimal
 
164
 
165
  message = params.get("message", {})
166
  message_text = ""
 
160
  # Handle message/send method
161
  if method == "message/send":
162
  # Lazy load brain for processing
163
+ import openclaw # Sets up sys.path
164
+ from agents import brain_minimal
165
 
166
  message = params.get("message", {})
167
  message_text = ""
error_handlers.py CHANGED
@@ -146,7 +146,8 @@ def handle_brain_response(message: str) -> str:
146
  AttributeError: If required brain methods are missing.
147
  """
148
  try:
149
- # Import directly since .openclaw is in sys.path after openclaw import
 
150
  from agents.brain_minimal import BrainMinimal
151
 
152
  brain = BrainMinimal(agent_name="cain", legacy_mode=True)
 
146
  AttributeError: If required brain methods are missing.
147
  """
148
  try:
149
+ # Import openclaw first to set up sys.path, then import agents
150
+ import openclaw
151
  from agents.brain_minimal import BrainMinimal
152
 
153
  brain = BrainMinimal(agent_name="cain", legacy_mode=True)