Skip to content

Fix UnicodeEncodeError in gtn config list on cp1252 consoles - #5489

Open
ClaraOswald076 wants to merge 2 commits into
griptape-ai:mainfrom
ClaraOswald076:fix/issue-5470
Open

ClaraOswald076 wants to merge 2 commits into
griptape-ai:mainfrom
ClaraOswald076:fix/issue-5470

Conversation

@ClaraOswald076

Copy link
Copy Markdown

Summary

Fixes #5470.

gtn config list printed its header containing U+27F6 (, long rightwards
arrow) and then crashed with UnicodeEncodeError: 'charmap' codec can't encode character '\u27f6' on any Windows console/pipe whose stdout encoding is the
legacy cp1252 code page. This replaces that one character with the ASCII arrow
->, so the command works on every console.

Changes

  • src/griptape_nodes/cli/commands/config.py: -> -> in the
    _list_user_configs() header, plus a comment explaining why the character
    must stay ASCII
  • tests/unit/cli/commands/test_config.py (new): regression test that swaps
    the shared console for one writing through a strict-cp1252 BytesIO wrapper
    and asserts _list_user_configs() completes without raising

Test evidence

Windows, Python 3.12.13, pytest 9.1.1.

Before (upstream code with the regression test applied, via git stash):

C:\...\Lib\encodings\cp1252.py:19: UnicodeEncodeError
FAILED tests/unit/cli/commands/test_config.py::TestListUserConfigs::test_lists_user_configs_on_cp1252_stdout
======================== 1 failed, 1 warning in 13.89s ========================

End-to-end repro on upstream code (cp1252 stdout):

UnicodeEncodeError: 'charmap' codec can't encode character '\u27f6' in position 1: character maps to <undefined>

After:

tests/unit/cli/commands/test_config.py::TestListUserConfigs::test_lists_user_configs_on_cp1252_stdout PASSED
======================== 1 passed, 1 warning in 7.25s =========================

pytest tests/unit/cli -q: main baseline 4 failed, 15 passed vs this branch
4 failed, 16 passed — the 4 failures are pre-existing network-dependent
doctor/websocket tests, unrelated to this change; no regressions.

Note: src/griptape_nodes/cli/commands/libraries.py lines 53/56 use //,
which have the same cp1252 failure mode. Left out of this PR to keep it scoped
to the reported command; happy to follow up.

@collindutter collindutter left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you!

@collindutter collindutter left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@ClaraOswald076 it looks like some checks are failing, could you please get them passing? Otherwise PR is good with me!

@codecov

codecov Bot commented Sep 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@ClaraOswald076

Copy link
Copy Markdown
Author

Fixed the lint and type-check failures in 26571df — the test now passes ruff (annotations) and pyright (captures console output via an explicit BytesIO instead of reaching into TextIOWrapper.buffer). The remaining version-ahead failure is the release-bump policy check (branch is at 0.100.0 while the latest release is v0.101.0) — it should clear once the bump lands on main, same as on other PRs.

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.

gtn config list crashes with UnicodeEncodeError on Windows legacy cp1252 consoles

2 participants