From fff247928ccb5e78ff56a53f5c14a39627dc50d5 Mon Sep 17 00:00:00 2001 From: Chad Bailey Date: Wed, 3 Apr 2024 00:43:57 +0000 Subject: [PATCH] modularized local transport --- src/dailyai/transports/local_transport.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/dailyai/transports/local_transport.py b/src/dailyai/transports/local_transport.py index 1e791a467..4b24fb535 100644 --- a/src/dailyai/transports/local_transport.py +++ b/src/dailyai/transports/local_transport.py @@ -1,7 +1,6 @@ import asyncio import numpy as np import tkinter as tk -import pyaudio from dailyai.transports.threaded_transport import ThreadedTransport @@ -9,6 +8,13 @@ class LocalTransport(ThreadedTransport): def __init__(self, **kwargs): super().__init__(**kwargs) + try: + global pyaudio + import pyaudio + except ModuleNotFoundError as e: + print(f"Exception: {e}") + print("In order to use the local transport, you'll need to `pip install pyaudio`. On MacOS, you'll also need to `brew install portaudio`.") + raise Exception(f"Missing module: {e}") self._sample_width = kwargs.get("sample_width") or 2 self._n_channels = kwargs.get("n_channels") or 1 self._tk_root = kwargs.get("tk_root") or None