Skip to content

AI agent skill that researches any topic across Reddit, X, YouTube, HN, Polymarket, and the web - then synthesizes a grounded summary

fix: wrap open() calls in 'with' to close file descriptors promptly (#774) (#775)

SAI MOHANEESH541717af302f
diff --git a/skills/last30days/scripts/last30days.py b/skills/last30days/scripts/last30days.py
index 30754cd1..0fd5902a 100644
--- a/skills/last30days/scripts/last30days.py
+++ b/skills/last30days/scripts/last30days.py
@@ -437,7 +437,8 @@ def parse_competitors_plan(raw: str | None) -> dict[str, dict]:
plan_str = raw
if os.path.isfile(plan_str):
try:
- plan_str = open(plan_str, encoding="utf-8").read()
+ with open(plan_str, encoding="utf-8") as f:
+ plan_str = f.read()
except (OSError, UnicodeDecodeError) as exc:
sys.stderr.write(f"[CompetitorsPlan] Cannot read plan file: {exc}\n")
raise SystemExit(2)
@@ -1171,7 +1172,8 @@ def main() -> int:
plan_str = args.plan
if os.path.isfile(plan_str):
try:
- plan_str = open(plan_str, encoding="utf-8").read()
+ with open(plan_str, encoding="utf-8") as f:
+ plan_str = f.read()
except (OSError, UnicodeDecodeError) as exc:
sys.stderr.write(f"[Planner] Cannot read --plan file: {exc}\n")
raise SystemExit(2)
diff --git a/uv.lock b/uv.lock
index de2e6dbf..a32f464c 100644
--- a/uv.lock
+++ b/uv.lock
@@ -106,7 +106,7 @@ wheels = [
[[package]]
name = "last30days-skill"
-version = "3.11.0"
+version = "3.11.1"
source = { virtual = "." }
[package.dev-dependencies]