diff --git a/speedtest/speedtest.py b/speedtest/speedtest.py index 4d16bc2..ea1daa4 100644 --- a/speedtest/speedtest.py +++ b/speedtest/speedtest.py @@ -36,11 +36,14 @@ class Speedtest(commands.Cog): return "\n".join(text) async def run_speedtest(self) -> str | Any: - process = await asyncio.create_subprocess_exec( - "speedtest", "-f json", "--accept-license", - stdout=subprocess.PIPE, - stderr=subprocess.PIPE - ) + try: + process = await asyncio.create_subprocess_exec( + "speedtest", "-f json", "--accept-license", + stdout=subprocess.PIPE, + stderr=subprocess.PIPE + ) + except FileNotFoundError: + return "Speedtest CLI is not installed." stdout, stderr = await process.communicate() if process.returncode != 0: return stderr.decode("utf-8")