Skip to content

fix(tools,cli,gateway): add encoding="utf-8" to subprocess.run with text=True - #52784

Closed
AlexFucuson9 wants to merge 1 commit into
NousResearch:mainfrom
AlexFucuson9:fix/subprocess-text-no-encoding
Closed

fix(tools,cli,gateway): add encoding="utf-8" to subprocess.run with text=True#52784
AlexFucuson9 wants to merge 1 commit into
NousResearch:mainfrom
AlexFucuson9:fix/subprocess-text-no-encoding

Conversation

@AlexFucuson9

Copy link
Copy Markdown
Contributor

Summary

subprocess.run(..., text=True) without explicit encoding uses the system locale, which varies across platforms:

  • Linux: typically UTF-8
  • Windows: cp1252 or mbcs (system locale)

This causes mojibake on Windows when processing UTF-8 output from ffmpeg, whisper, and other tools.

Files changed (11 call sites, 8 files)

File Line Tool
tools/tts_tool.py 1862 ffmpeg
tools/transcription_tools.py 1190, 1236, 1238 whisper/ffmpeg
tools/environments/singularity.py 223 singularity
tools/voice_mode.py 392, 409 microphone check
hermes_cli/setup.py 1443 ssh probe
hermes_cli/main.py 1158 hermes update
tui_gateway/server.py 8996 codex CLI
skills/creative/comfyui/scripts/auto_fix_deps.py 54 pip install

Test plan

  • python3 -m py_compile on all 8 changed files
  • Existing tests pass unchanged (UTF-8 is already the expected encoding on Linux)

…ext=True

subprocess.run(..., text=True) without explicit encoding uses the
system locale, which varies across platforms (Windows defaults to
cp1252/mbcs, Linux to UTF-8). This causes mojibake on Windows when
processing UTF-8 output from ffmpeg, whisper, and other tools.

Add encoding="utf-8" to 11 subprocess.run calls across 8 files.
@alt-glitch alt-glitch added type/bug Something isn't working comp/cli CLI entry point, hermes_cli/, setup wizard tool/tts Text-to-speech and transcription comp/tui Terminal UI (ui-tui/ + tui_gateway/) platform/windows Native Windows-specific behavior or breakage P2 Medium — degraded but workaround exists sweeper:risk-platform-windows Sweeper risk: may break or behave differently on native Windows duplicate This issue or pull request already exists labels Jun 26, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.

Duplicate of #52249 — byte-for-byte identical diff (same 8 files, same 11 call sites) by the same author. #52249 is the earlier open PR; closing here in its favor.

@christian-byrne Tagging you on this ComfyUI item (skills/creative/comfyui/scripts/auto_fix_deps.py is among the changed files).

@tonydwb tonydwb 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.

Code Review Summary

Verdict: Approved

Looks Good

  • Mechanical fix: adds encoding="utf-8" to subprocess.run() calls across 8 files
  • Ensures consistent UTF-8 decoding on all platforms (especially Windows)
  • Prevents UnicodeDecodeError on non-ASCII output
  • No behavioral changes — purely encoding safety
  • Touches CLI, gateway, tools, and skill scripts uniformly

Reviewed by Hermes Agent

@teknium1

Copy link
Copy Markdown
Contributor

Closing as superseded by the consolidated Windows console-flash work tracked in #54220.

The relevant pieces from this PR/cluster have now landed through the targeted follow-up PRs #54236, #53892, and #54417, or are recorded in the umbrella tracker for any remaining native-Windows verification. Keeping this separate PR open would duplicate the tracker and the merged follow-up work.

Thanks for digging into this — the reports and PRs in this cluster helped identify the remaining spawn legs.

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

Labels

comp/cli CLI entry point, hermes_cli/, setup wizard comp/tui Terminal UI (ui-tui/ + tui_gateway/) duplicate This issue or pull request already exists P2 Medium — degraded but workaround exists platform/windows Native Windows-specific behavior or breakage sweeper:risk-platform-windows Sweeper risk: may break or behave differently on native Windows tool/tts Text-to-speech and transcription type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants