Skip to content

fix: make CLI helpers run on Windows (cp1252 console + ffmpeg path)#78

Open
Pcecil21 wants to merge 1 commit into
browser-use:mainfrom
Pcecil21:fix/windows-cross-platform
Open

fix: make CLI helpers run on Windows (cp1252 console + ffmpeg path)#78
Pcecil21 wants to merge 1 commit into
browser-use:mainfrom
Pcecil21:fix/windows-cross-platform

Conversation

@Pcecil21

@Pcecil21 Pcecil21 commented Jun 19, 2026

Copy link
Copy Markdown

Problem

On a Windows (cp1252) console: (1) helpers crash with UnicodeEncodeError because status print() calls use U+2192 / U+2014 glyphs that cp1252 can't encode; (2) grade.py --analyze fails because a Windows temp path in the metadata=print:file=... filter collides with filtergraph : / \ delimiters.

Fix

  1. Reconfigure stdout/stderr to UTF-8 at import in the four helpers that print non-ASCII (no-op where the stream is already UTF-8).
  2. Pass a bare filename and set ffmpeg's cwd to the temp dir; resolve the input video to an absolute path first so the cwd change can't break a relative -i input.

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, and transcribe_batch.py all run clean with no PYTHONUTF8 workaround. 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.

  • Bug Fixes
    • Force UTF-8 on stdout/stderr at import in helpers/grade.py, helpers/pack_transcripts.py, helpers/render.py, and helpers/transcribe_batch.py so non-ASCII status prints don’t crash on Windows.
    • In grade.py --analyze, pass a bare metadata filename and set ffmpeg’s cwd to the temp dir; resolve the input video to an absolute path so the cwd change doesn’t break relative -i inputs.

Written for commit 406ab10. Summary will update on new commits.

Review in cubic

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.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 5 files

Re-trigger cubic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant