Jun-22-2018, 09:49 AM
A recent Windows update (Windows 10 version 1803 feature update) seems to have changed the behaviour of msvcrt.getch(). I confirmed this by testing on a second computer before and after the update.
this code:
Am I going crazy, or am I using msvcrt.getch() wrong since the Windows update?
What I really need is to put a keystroke in to a variable and print it to the command line, but it's printing an extra line after each character and my program no longer works.
hitting the 'b' key three times with this code:
this code:
import msvcrt while True: character = msvcrt.getch() print('Hello World')prints twice for each keystroke:
Output:Hello World
Hello World
tested with python 3.6.5 and 3.5.3Am I going crazy, or am I using msvcrt.getch() wrong since the Windows update?
What I really need is to put a keystroke in to a variable and print it to the command line, but it's printing an extra line after each character and my program no longer works.
hitting the 'b' key three times with this code:
import msvcrt while True: character = msvcrt.getch().decode('utf-8') print(character)Gives this output:
Output:b
b
b
Any ideas as to what has changed?