From 62fb8d0227bf8976b27afe8acbef155b7da37ce4 Mon Sep 17 00:00:00 2001 From: Benjamin Schwartz Date: Tue, 02 Oct 2007 17:42:00 +0000 Subject: Fixed Deadlock and File Error --- (limited to 'arange.py') diff --git a/arange.py b/arange.py index 0f1e135..0d537e4 100755 --- a/arange.py +++ b/arange.py @@ -219,11 +219,17 @@ def start_recording_alsa(): rec_process = subprocess.Popen(["/usr/bin/arecord", "--file-type=raw", "--channels=1", "--format=S16_LE", "--rate=48000", fname]) - while not os.path.exists(fname): - time.sleep(0.02) - - while os.path.getsize(fname) <= 0: - time.sleep(0.02) +# while not os.path.exists(fname): +# time.sleep(0.02) +# +# while os.path.getsize(fname) <= 0: +# time.sleep(0.02) + s = 0 + while s <= 0: + try: + s = os.path.getsize(fname) + except os.error: + time.sleep(0.02) #f = open(fname,'rb') return (rec_process, f) -- cgit v0.9.1