From 8613e56fa0869e42282e9cdc738c56976c632706 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josef=20H=C3=B6lzl?= Date: Mon, 26 Feb 2018 12:22:18 +0100 Subject: [PATCH 1/2] Fixed never ending loop while loop did not end in Python 3.5.2, variable `data` was never empty --- ndev/asr.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ndev/asr.py b/ndev/asr.py index 7bddcac..629812a 100644 --- a/ndev/asr.py +++ b/ndev/asr.py @@ -350,7 +350,7 @@ def __read_wav_file_in_chunks(filepath): print " Audio File %s" % filepath data = file_to_play.readframes(ASR.chunk_size) total_chunks = 0 - while data != '': + while 100*total_chunks/total_size != 100: total_chunks += len(data) stdout.write("\r Bytes Sent %d/%d \t%d%% " % (total_chunks,total_size,100*total_chunks/total_size)) stdout.flush() From 7a0cbb9faf771b7f3b73f3da575b397c100adea8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josef=20H=C3=B6lzl?= Date: Mon, 26 Feb 2018 13:23:33 +0100 Subject: [PATCH 2/2] Better expression --- ndev/asr.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ndev/asr.py b/ndev/asr.py index 629812a..fa0cb13 100644 --- a/ndev/asr.py +++ b/ndev/asr.py @@ -350,7 +350,7 @@ def __read_wav_file_in_chunks(filepath): print " Audio File %s" % filepath data = file_to_play.readframes(ASR.chunk_size) total_chunks = 0 - while 100*total_chunks/total_size != 100: + while data != b'': total_chunks += len(data) stdout.write("\r Bytes Sent %d/%d \t%d%% " % (total_chunks,total_size,100*total_chunks/total_size)) stdout.flush()