Skip to content

fix(cli): add explicit encoding to read_text/write_text in main.py - #51177

Closed
AlexFucuson9 wants to merge 1 commit into
NousResearch:mainfrom
AlexFucuson9:alex/fix-encoding-main
Closed

fix(cli): add explicit encoding to read_text/write_text in main.py#51177
AlexFucuson9 wants to merge 1 commit into
NousResearch:mainfrom
AlexFucuson9:alex/fix-encoding-main

Conversation

@AlexFucuson9

Copy link
Copy Markdown
Contributor

Summary

Add encoding="utf-8" to 6 remaining read_text()/write_text() calls in hermes_cli/main.py (1 already had encoding).

Path.read_text() defaults to system locale (cp1252 on Windows), causing UnicodeDecodeError for UTF-8 content. Ruff rule PLW1514.

Test plan

  • python3 -m py_compile hermes_cli/main.py passes
  • All calls fixed

Add encoding="utf-8" to all 6 remaining read_text()/write_text() calls
in hermes_cli/main.py. L6773 already had encoding.

Calls fixed:
- 4x read_text() -> read_text(encoding="utf-8")
- 2x write_text(content) -> write_text(content, encoding="utf-8")

Path.read_text() defaults to system locale (cp1252 on Windows).
Ruff rule PLW1514.
@AlexFucuson9
AlexFucuson9 force-pushed the alex/fix-encoding-main branch 2 times, most recently from d798df1 to 080dab0 Compare June 23, 2026 03:34
@alt-glitch alt-glitch added type/bug Something isn't working comp/cli CLI entry point, hermes_cli/, setup wizard P3 Low — cosmetic, nice to have sweeper:risk-platform-windows Sweeper risk: may break or behave differently on native Windows duplicate This issue or pull request already exists labels Jun 23, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.

Duplicate of #50655 — that earlier (still-open) encoding-guard rollout already covers the read_text/write_text calls in hermes_cli/main.py (its diff edits main.py alongside 7 other CLI files). Suggest folding into / closing in favor of #50655.

@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

Allows Slack to transcribe in-app voice messages with audio/mp4 MIME type instead of failing. Simple, focused fix (2 files, 298 additions) that broadens audio format support. No security concerns.


Reviewed by Hermes Agent

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 duplicate This issue or pull request already exists P3 Low — cosmetic, nice to have sweeper:risk-platform-windows Sweeper risk: may break or behave differently on native Windows type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants