Fix setup wizard crash on Windows (termios/tty are Unix-only)#11
Open
noahoja-commits wants to merge 1 commit into
Open
Fix setup wizard crash on Windows (termios/tty are Unix-only)#11noahoja-commits wants to merge 1 commit into
noahoja-commits wants to merge 1 commit into
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On Windows, the first-run setup wizard crashes at the "Press your RECORD hotkey" step:
setup_wizard.py'scapture_hotkey()importstermiosandttyand callstermios.tcgetattr(sys.stdin.fileno())unconditionally. Those modules are Unix-only, so the wizard is unusable on Windows even though the README advertises Windows support (andtalktype.pyitself is otherwise Windows-aware — it uses actypesmutex lock andpyautoguifor paste).Fix
The raw-mode handling only suppresses terminal echo of the keypress while
pynputcaptures it — it's cosmetic and Unix-specific. This PR guards thetermios/ttyimport + raw-mode setup in atry/exceptso 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
capture_hotkey()returns the pressed key.termiosis available.py_compilepasses onsetup_wizard.py,talktype.py,whisper_server.py.🤖 Generated with Claude Code