From f00f7f099f999b8238abade5420eaef5be94e386 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Thu, 16 Sep 2021 10:16:04 +1000 Subject: [PATCH] possible fix for reported audio issues https://forums.ankiweb.net/t/2-1-48-release-candidate/13268/6 This is the only area of the sound code that has changed since 2.1.47 --- qt/aqt/sound.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/qt/aqt/sound.py b/qt/aqt/sound.py index 3001d2c68..9b287b667 100644 --- a/qt/aqt/sound.py +++ b/qt/aqt/sound.py @@ -313,8 +313,11 @@ class SimpleProcessPlayer(Player): # pylint: disable=abstract-method if self._terminate_flag: self._process.terminate() self._process.wait(1) - if self._process.stdin: - self._process.stdin.close() + try: + if self._process.stdin: + self._process.stdin.close() + except Exception as e: + print("unable to close stdin:", e) self._process = None return @@ -323,8 +326,11 @@ class SimpleProcessPlayer(Player): # pylint: disable=abstract-method self._process.wait(0.1) if self._process.returncode != 0: print(f"player got return code: {self._process.returncode}") - if self._process.stdin: - self._process.stdin.close() + try: + if self._process.stdin: + self._process.stdin.close() + except Exception as e: + print("unable to close stdin:", e) self._process = None return except subprocess.TimeoutExpired: