From 0006269c01c89dd8e9c632b7b8ddf44817670b07 Mon Sep 17 00:00:00 2001 From: evandrocoan Date: Mon, 4 May 2020 23:45:06 -0300 Subject: [PATCH] Used showWarning asking the user to install pyaudio --- qt/aqt/sound.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/qt/aqt/sound.py b/qt/aqt/sound.py index e6d0e8a15..d5f89737f 100644 --- a/qt/aqt/sound.py +++ b/qt/aqt/sound.py @@ -27,9 +27,7 @@ from aqt.utils import restoreGeom, saveGeom, showWarning, startup_info try: import pyaudio except: - print( - "Warning: pyaudio is not installed and audio recording will not work! Install it with: python3 -m pip install pyaudio" - ) + pyaudio = None # AV player protocol @@ -526,6 +524,11 @@ Recorder = PyAudioRecorder def getAudio(parent: QWidget, encode: bool = True) -> Optional[str]: "Record and return filename" + if not pyaudio: + showWarning( + "The Python pip `pyaudio` dependency is not installed and audio recording will not work!" + ) + return None # record first r = Recorder() mb = QMessageBox(parent)