fix: make CLI helpers run on Windows (cp1252 console + ffmpeg path)#78
Open
Pcecil21 wants to merge 1 commit into
Open
fix: make CLI helpers run on Windows (cp1252 console + ffmpeg path)#78Pcecil21 wants to merge 1 commit into
Pcecil21 wants to merge 1 commit into
Conversation
Two cross-platform issues surfaced running the helpers on a Windows (cp1252) console: 1. Status print() calls contain non-ASCII glyphs (U+2192 right-arrow, U+2014 em-dash). Windows stdout defaults to cp1252, which can't encode them, so the helpers raise UnicodeEncodeError -- grade.py before it grades anything, pack_transcripts.py after writing its file. Fix: reconfigure stdout/stderr to UTF-8 at import in the four helpers that print non-ASCII (a no-op where the stream is already UTF-8). 2. grade.py --analyze embedded a Windows temp path in the ffmpeg 'metadata=print:file=...' filter, where ':' and '\' are filtergraph delimiters, so ffmpeg failed to parse it. Fix: pass a bare filename and run ffmpeg with cwd set to the temp file's directory; the input video is resolved to an absolute path first so the cwd change can't break a relative '-i' input. Adds tests/test_grade_path.py: cross-platform assertions for the metadata path handling (pass on Windows and Linux) plus a regression for the cp1252 print path. Verified manually on Windows -- pack_transcripts.py, grade.py --analyze (incl. a relative input), render.py --preview, and transcribe_batch.py all run clean with no PYTHONUTF8 workaround. No behavior change on macOS/Linux.
This was referenced Jun 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On a Windows (cp1252) console: (1) helpers crash with
UnicodeEncodeErrorbecause statusprint()calls use U+2192 / U+2014 glyphs that cp1252 can't encode; (2)grade.py --analyzefails because a Windows temp path in themetadata=print:file=...filter collides with filtergraph:/\delimiters.Fix
stdout/stderrto UTF-8 at import in the four helpers that print non-ASCII (no-op where the stream is already UTF-8).cwdto the temp dir; resolve the input video to an absolute path first so the cwd change can't break a relative-iinput.Adds
tests/test_grade_path.py(cross-platform; passes on Windows and Linux). Verified manually on Windows:pack_transcripts.py,grade.py --analyze(incl. a relative input),render.py --preview, andtranscribe_batch.pyall run clean with noPYTHONUTF8workaround. No behavior change on macOS/Linux.Summary by cubic
Make the CLI helpers run reliably on Windows by forcing UTF-8 console output and fixing how we pass the ffmpeg metadata file path. Prevents UnicodeEncodeError on cp1252 consoles and filtergraph parsing failures; no behavior change on macOS/Linux.
helpers/grade.py,helpers/pack_transcripts.py,helpers/render.py, andhelpers/transcribe_batch.pyso non-ASCII status prints don’t crash on Windows.grade.py --analyze, pass a bare metadata filename and set ffmpeg’scwdto the temp dir; resolve the input video to an absolute path so thecwdchange doesn’t break relative-iinputs.Written for commit 406ab10. Summary will update on new commits.