Skip to content

πŸ™Œ OpenHands: AI-Driven Development

Suppress pydub warning about ffmpeg/avconv not found (#8940)

Robert Brennan147ffb7e42e9
diff --git a/openhands/cli/main.py b/openhands/cli/main.py
index b0e523f2fa..cf9c14e301 100644
--- a/openhands/cli/main.py
+++ b/openhands/cli/main.py
@@ -8,6 +8,7 @@ from prompt_toolkit.formatted_text import HTML
from prompt_toolkit.shortcuts import clear
import openhands.agenthub # noqa F401 (we import this to get the agents registered)
+import openhands.cli.suppress_warnings # noqa: F401
from openhands.cli.commands import (
check_folder_security_agreement,
handle_commands,
diff --git a/openhands/cli/suppress_warnings.py b/openhands/cli/suppress_warnings.py
new file mode 100644
index 0000000000..3f61cd7186
--- /dev/null
+++ b/openhands/cli/suppress_warnings.py
@@ -0,0 +1,10 @@
+"""Module to suppress common warnings."""
+
+import warnings
+
+# Suppress pydub warning about ffmpeg/avconv
+warnings.filterwarnings(
+ 'ignore',
+ message="Couldn't find ffmpeg or avconv - defaulting to ffmpeg, but may not work",
+ category=RuntimeWarning,
+)
diff --git a/openhands/core/main.py b/openhands/core/main.py
index df67e8746f..d6f0d67c0e 100644
--- a/openhands/core/main.py
+++ b/openhands/core/main.py
@@ -5,6 +5,7 @@ from pathlib import Path
from typing import Callable, Protocol
import openhands.agenthub # noqa F401 (we import this to get the agents registered)
+import openhands.cli.suppress_warnings # noqa: F401
from openhands.controller.agent import Agent
from openhands.controller.replay import ReplayManager
from openhands.controller.state.state import State