Skip to content

Fix setup wizard crash on Windows (termios/tty are Unix-only)#11

Open
noahoja-commits wants to merge 1 commit into
lmacan1:mainfrom
noahoja-commits:fix/windows-wizard-termios
Open

Fix setup wizard crash on Windows (termios/tty are Unix-only)#11
noahoja-commits wants to merge 1 commit into
lmacan1:mainfrom
noahoja-commits:fix/windows-wizard-termios

Conversation

@noahoja-commits

Copy link
Copy Markdown

Problem

On Windows, the first-run setup wizard crashes at the "Press your RECORD hotkey" step:

ModuleNotFoundError: No module named 'termios'

setup_wizard.py's capture_hotkey() imports termios and tty and calls termios.tcgetattr(sys.stdin.fileno()) unconditionally. Those modules are Unix-only, so the wizard is unusable on Windows even though the README advertises Windows support (and talktype.py itself is otherwise Windows-aware — it uses a ctypes mutex lock and pyautogui for paste).

Fix

The raw-mode handling only suppresses terminal echo of the keypress while pynput captures it — it's cosmetic and Unix-specific. This PR guards the termios/tty import + raw-mode setup in a try/except so it's skipped on Windows (and on non-tty stdin), and only restores terminal settings when they were actually captured. pynput's listener captures the key identically on all platforms, so behavior on Linux/macOS is unchanged.

Testing

  • Windows (Python 3.14): wizard now reaches and completes the hotkey-capture step instead of crashing; capture_hotkey() returns the pressed key.
  • Linux/macOS behavior unchanged — raw-mode echo suppression still applies where termios is available.
  • py_compile passes on setup_wizard.py, talktype.py, whisper_server.py.

🤖 Generated with Claude Code

capture_hotkey() imported termios and tty at the top of the function and
called termios.tcgetattr(sys.stdin.fileno()) unconditionally. Those modules
don't exist on Windows, so the first-run setup wizard crashed with
ModuleNotFoundError at the "Press your RECORD hotkey" step, making the
wizard unusable on Windows despite the README advertising Windows support.

Raw-mode handling only suppresses the terminal echo of the keypress while
pynput captures it — it's cosmetic and Unix-specific. Guard the
termios/tty import + raw-mode setup in a try/except so it's skipped on
Windows (and on non-tty stdin), and only restore terminal settings when
they were actually captured. pynput's listener captures the key the same
way on all platforms.

Verified on Windows (Python 3.14): wizard now reaches and completes the
hotkey capture step instead of crashing.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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