From 3cb30504e5133825d4585f5c805f7dc1a1f10eab Mon Sep 17 00:00:00 2001 From: erew123 <35898566+erew123@users.noreply.github.com> Date: Sun, 24 Nov 2024 11:30:03 +0000 Subject: [PATCH] Try statement to capture missing imports hopefully will catch those whom don't reinstall requirements --- script.py | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/script.py b/script.py index 2abb88b..d59e5e1 100644 --- a/script.py +++ b/script.py @@ -70,15 +70,31 @@ from datetime import datetime, timedelta from pathlib import Path import gradio as gr import numpy as np -import plotly.graph_objects as go import requests from requests.exceptions import ConnectionError as RequestsConnectionError from requests.exceptions import RequestException -from scipy import signal as scipy_signal import soundfile as sf from tqdm import tqdm import torch -import whisper +try: + import whisper + import soundfile as sf + import plotly.graph_objects as go + from scipy import signal as scipy_signal +except ImportError as e: + print(f"Error: {e}") + print("=" * 50) + print("🚨 Missing Dependencies Detected 🚨\n") + print( + "It seems you are missing some required packages.\n" + "To resolve this, please install the dependencies by running:\n" + ) + print(" 🔹 pip install -r system/requirements/requirements_standalone.txt") + print(" 🔹 or use the 'atsetup' command\n") + print("Once the installation is complete, try running the script again.") + print("=" * 50) + sys.exit(1) # Exit the script to avoid further errors + this_dir = Path(__file__).parent.resolve() # Note: The following function names are reserved for TGWUI integration.