From cd673d50d1acc3cb3f5d169a7e807fdf812bf7c8 Mon Sep 17 00:00:00 2001 From: Mike Naberezny Date: Fri, 12 Oct 2018 10:30:29 -0700 Subject: [PATCH] Revert "Ignore termios error in getch_noblock(). Fixes #46" This reverts commit 7ed4d95885f91b70c5814ec308d5d2eb78d13f23. --- CHANGES.txt | 4 ---- py65/utils/console.py | 8 ++------ 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index c2ef4c4..1b9e9b5 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -5,10 +5,6 @@ Py65 now requires Python 3.4 or later. On Python 2, Py65 now requires Python 2.7. - - Added a workaround to ignore an error ``Error: , - (25, 'Inappropriate ioctl for device')`` that may occur on some systems - when reading character input. Based on a patch by Marko Lauke. - 1.1.0 (2018-07-01) ------------------ diff --git a/py65/utils/console.py b/py65/utils/console.py index b111bc1..eb15df0 100644 --- a/py65/utils/console.py +++ b/py65/utils/console.py @@ -49,14 +49,9 @@ else: character. If no character is available, an empty string is returned. """ - char = '' fd = stdin.fileno() - try: - oldterm = termios.tcgetattr(fd) - except termios.error: # https://github.com/mnaberez/py65/issues/46 - return char - + oldterm = termios.tcgetattr(fd) newattr = oldterm[:] newattr[3] = newattr[3] & ~termios.ICANON & ~termios.ECHO termios.tcsetattr(fd, termios.TCSANOW, newattr) @@ -65,6 +60,7 @@ else: fcntl.fcntl(fd, fcntl.F_SETFL, oldflags | os.O_NONBLOCK) try: + char = '' r, w, e = select.select([fd], [], [], 0.1) if r: char = stdin.read(1)