Opened 3 months ago

Closed 8 weeks ago

#3518 closed bug (Fixed)

Unhandled ValueError in colors.py causes startup crash

Reported by: fedevx Owned by:
Priority: major Milestone: 2.1.0
Component: Console UI Version: master
Keywords: Cc:

Description

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

Change History (1)

comment:1 Changed 8 weeks ago by Cas

  • Milestone changed from needs verified to 2.1.0
  • Resolution set to Fixed
  • Status changed from new to closed

Thanks for reporting, looks like a change in Python 3.10 and fixed via [cd63efd93]

Note: See TracTickets for help on using tickets.