Claude Code Claude Opus 4.6 commited on
Commit
e74ef2e
·
1 Parent(s): 85d96fe

Claude Code: Fix openclaw path resolution - use direct nested path

Browse files

Simplify __init__.py to always use openclaw/.openclaw path
instead of complex fallback logic that may fail.

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

Files changed (1) hide show
  1. openclaw/__init__.py +8 -13
openclaw/__init__.py CHANGED
@@ -4,20 +4,15 @@ import sys
4
  from pathlib import Path
5
 
6
  # Get the openclaw package directory
7
- _package_dir = Path(__file__).parent # /app/openclaw
8
 
9
- # Docker path fix: .openclaw is at /app/.openclaw, not /app/openclaw/.openclaw
10
- # Try relative path first (for local dev), fall back to /app/.openclaw (for Docker)
11
- _openclaw_dir = _package_dir / ".openclaw" # /app/openclaw/.openclaw (local)
12
- if not _openclaw_dir.exists():
13
- _openclaw_dir = _package_dir.parent / ".openclaw" # /app/.openclaw (Docker)
14
 
15
- # Add both openclaw parent (for agents) and .openclaw to the module search path
16
- if str(_package_dir) not in sys.path:
17
- sys.path.insert(0, str(_package_dir))
18
-
19
- # Critical: Add .openclaw to sys.path so "from agents import brain_minimal" works
20
- if str(_openclaw_dir) not in sys.path and _openclaw_dir.exists():
21
- sys.path.insert(0, str(_openclaw_dir))
22
 
23
  __version__ = "0.1.0"
 
4
  from pathlib import Path
5
 
6
  # Get the openclaw package directory
7
+ _package_dir = Path(__file__).parent # /app/openclaw (Docker) or workspace/openclaw (local)
8
 
9
+ # The .openclaw directory is always inside the openclaw package directory
10
+ # Docker: /app/openclaw/.openclaw
11
+ # Local: workspace/openclaw/.openclaw
12
+ _openclaw_internal = _package_dir / ".openclaw"
 
13
 
14
+ # Add to sys.path for "from agents import brain_minimal" to work
15
+ if str(_openclaw_internal) not in sys.path:
16
+ sys.path.insert(0, str(_openclaw_internal))
 
 
 
 
17
 
18
  __version__ = "0.1.0"