[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
This commit is contained in:
Calum Lind 2022-05-01 21:09:35 +01:00
parent 7f0a380576
commit cd63efd935
No known key found for this signature in database
GPG Key ID: 90597A687B836BA3
1 changed files with 2 additions and 2 deletions

View File

@ -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