comparison libervia/frontends/tools/webrtc.py @ 4145:970b6209526a

frontends (tools/webrtc): Better message on Python override missing: raise an exception instead of simple `print` to stop loading the module, and show a more detailed message with the package to install.
author Goffi <goffi@goffi.org>
date Thu, 02 Nov 2023 12:11:21 +0100
parents 6745c6bd4c7a
children 60d107f2178a
comparison
equal deleted inserted replaced
4144:14523ee96538 4145:970b6209526a
21 "Gst": "1.0", 21 "Gst": "1.0",
22 "GstWebRTC": "1.0" 22 "GstWebRTC": "1.0"
23 }) 23 })
24 from gi.repository import Gst, GstWebRTC, GstSdp 24 from gi.repository import Gst, GstWebRTC, GstSdp
25 25
26 from libervia.backend.core import exceptions
27
26 try: 28 try:
27 from gi.overrides import Gst as _ 29 from gi.overrides import Gst as _
28 except ImportError: 30 except ImportError:
29 print( 31 raise exceptions.MissingModule(
30 "no GStreamer python overrides available, please install relevant pacakges on " 32 "No GStreamer Python overrides available. Please install relevant packages on "
31 "your system." 33 "your system (e.g., `python3-gst-1.0` on Debian and derivatives)."
32 ) 34 )
33 import asyncio 35 import asyncio
34 from dataclasses import dataclass 36 from dataclasses import dataclass
35 from datetime import datetime 37 from datetime import datetime
36 import logging 38 import logging
37 import re 39 import re
38 from typing import Callable 40 from typing import Callable
39 from urllib.parse import quote_plus 41 from urllib.parse import quote_plus
40 42
41 from libervia.backend.core import exceptions
42 from libervia.backend.tools.common import data_format 43 from libervia.backend.tools.common import data_format
43 from libervia.frontends.tools import aio 44 from libervia.frontends.tools import aio
44 45
45 46
46 log = logging.getLogger(__name__) 47 log = logging.getLogger(__name__)