python-cross-platform-smoothing
Installation
SKILL.md
Python Cross-Platform Smoothing
Verified patterns for writing Python scripts that behave correctly on Windows, Linux, and macOS across CLI, TUI, and GUI contexts.
Unicode Output on Windows (Rich / Typer / any stdout)
Problem: Windows defaults stdout/stderr to a legacy code page (cp1252, cp437). Rich and Typer use Unicode characters (box-drawing, spinners, emoji) that these encodings cannot represent, causing UnicodeEncodeError at runtime.
Solution: Reconfigure streams before importing Rich or Typer.
import sys
from io import TextIOWrapper