From b079df2a139e728e684aa59ff5576296b7d727aa Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Thu, 18 Jun 2009 07:11:39 +0900 Subject: [PATCH] don't use communicate(), catch win32 error --- anki/sound.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/anki/sound.py b/anki/sound.py index 4d53f6e73..f1cc1a972 100644 --- a/anki/sound.py +++ b/anki/sound.py @@ -183,19 +183,22 @@ def stopMplayer(restart=False): if mplayerManager.mplayer: while 1: try: - mplayerManager.mplayer.communicate("quit\n") + mplayerManager.mplayer.stdin.write("quit\n") break except OSError, e: if e.errno != errno.EINTR: # osx throws interrupt errors regularly, but we want to # ignore other errors on shutdown break + except IOError: + # already closed + break except ValueError: # already closed break if not restart: mplayerManager.mplayer = -1 - mplayerCond.notify() + mplayerCond.notifyAll() mplayerCond.release() def stopMplayerOnce():