#3518: Unhandled ValueError in colors.py causes startup crash
----------------------------+------------------------
 Reporter:  fedevx          |       Type:  bug
   Status:  new             |   Priority:  major
Milestone:  needs verified  |  Component:  Console UI
  Version:  master          |   Keywords:
----------------------------+------------------------
 deluge-console 2.0.5
 libtorrent: 2.0.5.0
 Python: 3.10.4
 OS: Linux Arch Linux ARM
 Shell: Zsh

 As mentioned in the Summary, deluge-console crashes with the following
 traceback:

 {{{
 Traceback (most recent call last):
   File "/usr/bin/deluge-console", line 33, in <module>
     sys.exit(load_entry_point('deluge==2.0.5', 'console_scripts', 'deluge-
 console')())
   File "/usr/lib/python3.10/site-packages/deluge/ui/console/__init__.py",
 line 19, in start
     Console().start()
   File "/usr/lib/python3.10/site-packages/deluge/ui/console/console.py",
 line 164, in start
     return deluge.common.run_profiled(
   File "/usr/lib/python3.10/site-packages/deluge/common.py", line 1351, in
 run_profiled
     return func(*args)
   File "/usr/lib/python3.10/site-packages/deluge/ui/console/console.py",
 line 159, in run
     return c.start_ui()
   File "/usr/lib/python3.10/site-packages/deluge/ui/console/main.py", line
 164, in start_ui
     wrapper(self.run)
   File "/usr/lib/python3.10/curses/__init__.py", line 94, in
  wrapper
     return func(stdscr, *args, **kwds)
   File "/usr/lib/python3.10/site-packages/deluge/ui/console/main.py", line
 252, in run
     colors.init_colors()
   File "/usr/lib/python3.10/site-
 packages/deluge/ui/console/utils/colors.py", line 110, in init_colors
     counter = define_pair(counter, 'white', 'grey', curses.COLOR_WHITE,
 241)
   File "/usr/lib/python3.10/site-
 packages/deluge/ui/console/utils/colors.py", line 91, in define_pair
     curses.init_pair(counter, fg, bg)
 ValueError: Color number is greater than COLORS-1 (7).
 }}}

 A quick change in line [https://git.deluge-
 torrent.org/deluge/tree/deluge/ui/console/utils/colors.py#n94 94] of
 colors.py from:

 {{{ except curses.error as ex: }}}

 to:

 {{{ except (curses.error, ValueError) as ex: }}}

 Allows the program to continue and works as expected but you are welcome
 to dig into the root cause of the actual issue.

--
Ticket URL: <https://dev.deluge-torrent.org/ticket/3518>
Deluge <https://deluge-torrent.org/>
Deluge Project

-- 
You received this message because you are subscribed to the Google Groups 
"Deluge Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/deluge-dev/045.d1380d8fccd5137222919cb0a84c38ac%40deluge-torrent.org.

Reply via email to