skill-creator: fix Windows subprocess + encoding bugs - #1050
Conversation
|
Independent confirmation of these bugs from another Windows Where I hit them: marketplace-distributed copy of skill-creator at Confirmed:
Supplementary finding (FWIW — not asking you to expand scope): --- a/skills/skill-creator/scripts/improve_description.py
+++ b/skills/skill-creator/scripts/improve_description.py
@@ -10,6 +10,7 @@
import json
import os
import re
+import shutil
import subprocess
import sys
from pathlib import Path
@@ -23,7 +24,8 @@
Prompt goes over stdin (not argv) because it embeds the full SKILL.md
body and can easily exceed comfortable argv length.
"""
- cmd = ["claude", "-p", "--output-format", "text"]
+ claude_bin = shutil.which("claude") or "claude.cmd"
+ cmd = [claude_bin, "-p", "--output-format", "text"]
if model:
cmd.extend(["--model", model])
(I've already aligned the fallback with your Adopt-when-merged: I'll remove my local |
|
Independently reproduced the encoding bugs on Windows 11 (Python 3.13.4, cp1252 locale). To help make this fix comprehensive rather than whack-a-mole, here is a complete audit of locale-default text I/O across
The most impactful one is Verified on this machine that adding (Separate, out of scope here: Aside, unrelated to this PR's code: some context on how community code contributions here have been getting reviewed, for anyone weighing whether to invest effort: #1195 |
|
Pacific (Win11 Pro 26200, Python 3.13.13, uv, claude-code 2.1.145) confirms this PR's fixes are needed even with #1099 applied — my skill description has em-dashes ( #1050 and #1099 together are the full "skill-creator runs on Windows" change set. Both have multiple independent Windows repros at this point. Worth merging as a pair. |
Two Windows compatibility fixes for skill-creator scripts
Found while running
run_loop.pyon Windows 11. Both fixes are 1-line changes.1.
subprocess.Popen(["claude", ...])fails with[WinError 2]On Windows the CLI ships as
claude.cmd. Python's subprocess doesn't honorPATHEXTfor non-shell invocations, so it can't find the binary. Fix: useshutil.which("claude") or "claude.cmd"(or justclaude.cmdif cross-platform isn't a concern — the script is Windows-or-bust without this fix anyway).2.
write_text()fails withUnicodeEncodeErroron cp1252generate_report.pyandrun_loop.pyuse.write_text()without specifying encoding. On Windows,locale.getpreferredencoding()returns cp1252 by default, which can't encode the ✗/✓ characters in the HTML report. Fix: addencoding="utf-8"to every.write_text()call (5 in run_loop.py, 1 in generate_report.py).Tested locally — both fixes resolve the issues.