From a3c1eb79e64a88ecaba71b1bee773de2c029764c Mon Sep 17 00:00:00 2001 From: Kris Gesling Date: Thu, 17 Dec 2020 23:01:39 +0930 Subject: [PATCH] initialize errorcount value --- __init__.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/__init__.py b/__init__.py index 14d2714..95ddc40 100644 --- a/__init__.py +++ b/__init__.py @@ -157,6 +157,7 @@ def __init__(self): # Mic level indicatior self.thread = None self.pa = pyaudio.PyAudio() + self.error_count = 0 try: self.listener_file = os.path.join(get_ipc_directory(), "mic_level") self.st_results = os.stat(self.listener_file) @@ -321,8 +322,8 @@ def get_audio_level(self): block = self.stream.read(INPUT_FRAMES_PER_BLOCK) except IOError as e: # damn - self.errorcount += 1 - self.log.error("{} Error recording: {}".format(self.errorcount, e)) + self.error_count += 1 + self.log.error("{} Error recording: {}".format(self.error_count, e)) return None amplitude = get_rms(block)