Skip to content

Fix print_tree crash on Windows consoles; add demo video to README - #2

Merged
MrDebugger merged 3 commits into
mainfrom
windows-console-fix-and-demo
Oct 5, 2026
Merged

MrDebugger merged 3 commits into
mainfrom
windows-console-fix-and-demo

Conversation

@MrDebugger

Copy link
Copy Markdown
Owner

Summary

  • Fix: Protobuf.print_tree() raised UnicodeEncodeError on a default Windows PowerShell/cmd console (cp1252), because it printed the box-drawing connectors (├──, └──, │) straight to stdout. When stdout's encoding can't represent the tree, it now prints ASCII connectors (|--, `--, |) instead. The returned string is unchanged, and sys.stdout is never reconfigured.
  • examples/tree_operations.py now lets the library do the printing, so all 6 examples run on cp1252.
  • Docs: added a short demo video (assets/videos/deproto-demo.mp4) with a GIF preview embedded at the top of the README (absolute URLs, so it also renders on PyPI).
  • .gitignore: ignore posts/.

Testing

  • pytest tests/: 35 passed. Five new tests cover cp1252 stdout, utf-8 stdout, a stream with no encoding (StringIO), values cp1252 can't encode (replaced with ?), and stdout=False.
  • PYTHONIOENCODING=cp1252 python examples/<each>.py: all 6 examples run without errors.

🤖 Generated with Claude Code

https://claude.ai/code/session_01VQFgoGFSPp6o1zCgAL9tb5

MrDebugger and others added 3 commits October 5, 2026 19:17
print_tree() printed box-drawing connectors (├── └── │) straight to
stdout, raising UnicodeEncodeError on a default Windows PowerShell/cmd
console (cp1252). When stdout's encoding can't represent the tree, it
now prints ASCII connectors (|-- `-- |) instead; the returned string is
unchanged. examples/tree_operations.py now lets the library print.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VQFgoGFSPp6o1zCgAL9tb5
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VQFgoGFSPp6o1zCgAL9tb5
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VQFgoGFSPp6o1zCgAL9tb5
@MrDebugger
MrDebugger merged commit a9bbb31 into main Oct 5, 2026
5 checks passed
@MrDebugger
MrDebugger deleted the windows-console-fix-and-demo branch October 5, 2026 14:21
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