From cd63efd93557d04c0e3570fa89b338696811c8e0 Mon Sep 17 00:00:00 2001 From: Calum Lind Date: Sun, 1 May 2022 21:09:35 +0100 Subject: [PATCH] [Console] Fix curses.init_pair raise ValueError on Py3.10 Fix ValueError crash for console users with Python 3.10 Trac: https://dev.deluge-torrent.org/ticket/3518 See-also: https://docs.python.org/3/whatsnew/3.10.html#curses --- deluge/ui/console/utils/colors.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/deluge/ui/console/utils/colors.py b/deluge/ui/console/utils/colors.py index 67996e19c..cc414fea5 100644 --- a/deluge/ui/console/utils/colors.py +++ b/deluge/ui/console/utils/colors.py @@ -88,8 +88,8 @@ def init_colors(): curses.init_pair(counter, fg, bg) color_pairs[(fg_name, bg_name)] = counter counter += 1 - except curses.error as ex: - log.warning('Error: %s', ex) + except (curses.error, ValueError) as ex: + log.debug(f'Color pair {fg_name} {bg_name} not available: {ex}') return counter # Create the color_pairs dict