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: 4 additions & 4 deletions python/openshell/sandbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ def from_active_cluster(
gateway_dir = _xdg_config_home() / "openshell" / "gateways" / cluster_name
metadata_path = gateway_dir / "metadata.json"
try:
metadata = json.loads(metadata_path.read_text())
metadata = json.loads(metadata_path.read_text(encoding="utf-8"))
except FileNotFoundError:
raise SandboxError(f"gateway '{cluster_name}' not found") from None
if "gateway_endpoint" not in metadata:
Expand Down Expand Up @@ -846,7 +846,7 @@ def _read_oidc_token_bundle(gateway_dir: pathlib.Path) -> dict | None:
"""
token_path = gateway_dir / "oidc_token.json"
try:
return json.loads(token_path.read_text())
return json.loads(token_path.read_text(encoding="utf-8"))
except FileNotFoundError:
return None
except (OSError, json.JSONDecodeError):
Expand Down Expand Up @@ -1299,7 +1299,7 @@ def _write_to_disk(self, bundle: dict) -> None:
)
tmp_path = pathlib.Path(tmp_name)
try:
with os.fdopen(fd, "w") as f:
with os.fdopen(fd, "w", encoding="utf-8") as f:
f.write(payload)
with contextlib.suppress(OSError):
tmp_path.chmod(0o600)
Expand Down Expand Up @@ -1374,7 +1374,7 @@ def _resolve_active_cluster() -> str:
return env_gateway
active_file = _xdg_config_home() / "openshell" / "active_gateway"
try:
value = active_file.read_text().strip()
value = active_file.read_text(encoding="utf-8").strip()
except FileNotFoundError:
raise SandboxError("no active gateway configured") from None
if value == "":
Expand Down
Loading