From ca5b4d89b8a87405b49a1ef73e986e251018c76f Mon Sep 17 00:00:00 2001 From: totaam Date: Sun, 9 Oct 2022 20:54:44 +0700 Subject: [PATCH] less scary message when we can't load webcam components --- xpra/server/mixins/webcam_server.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/xpra/server/mixins/webcam_server.py b/xpra/server/mixins/webcam_server.py index bc96b913d6..33d9c47f34 100644 --- a/xpra/server/mixins/webcam_server.py +++ b/xpra/server/mixins/webcam_server.py @@ -68,11 +68,19 @@ def init_webcam(self): if not self.webcam_enabled: return try: + # pylint: disable=import-outside-toplevel from xpra.codecs.pillow.decoder import get_encodings + except ImportError: + log("init_webcam()", exc_info=True) + log.info("webcam forwarding cannot be enabled without the pillow decoder") + self.webcam_enabled = False + return + try: self.webcam_encodings = tuple(x for x in ("png", "jpeg", "webp") if x in get_encodings()) except Exception as e: + log("init_webcam()", exc_info=True) log.error("Error: webcam forwarding disabled:") - log.error(" %s", e) + log.estr(e) self.webcam_enabled = False if self.webcam_device: self.webcam_virtual_video_devices = 1 @@ -85,12 +93,13 @@ def init_virtual_video_devices(self): log("init_virtual_video_devices") if not POSIX or OSX: return 0 + # pylint: disable=import-outside-toplevel try: from xpra.codecs.v4l2.pusher import Pusher assert Pusher except ImportError: log("failed to import the virtual video module", exc_info=True) - log.info("no v4l2 virtual video module") + log.info("webcam forwarding requires the v4l2 virtual video module") return 0 try: from xpra.platform.xposix.webcam import get_virtual_video_devices, check_virtual_dir