Page 1 of 1

BadColorString from deluge-console info

Posted: Thu Feb 25, 2021 7:02 pm
by jbrid
Hi,
I recently upgraded to Ubuntu 20.04 and am getting an error when executing the 'deluge-console info' command. I have about 1,000 torrents. The info list displays about 50 of them and then hits this error:

Code: Select all

Error getting torrent info: [Failure instance: Traceback: <class 'deluge.ui.console.utils.colors.BadColorString'>: Number of 
/usr/lib/python3/dist-packages/deluge/transfer.py:129:_handle_complete_message
/usr/lib/python3/dist-packages/deluge/ui/client.py:133:message_received
/usr/local/lib/python3.8/dist-packages/twisted/internet/defer.py:460:callback
/usr/local/lib/python3.8/dist-packages/twisted/internet/defer.py:568:_startRunCallbacks
--- <exception caught here> ---
/usr/local/lib/python3.8/dist-packages/twisted/internet/defer.py:654:_runCallbacks
/usr/lib/python3/dist-packages/deluge/ui/console/cmdline/commands/info.py:184:on_torrents_status
/usr/lib/python3/dist-packages/deluge/ui/console/cmdline/commands/info.py:453:show_info
/usr/lib/python3/dist-packages/deluge/ui/console/main.py:499:write
/usr/lib/python3/dist-packages/deluge/ui/console/utils/colors.py:141:strip_colors
/usr/lib/python3/dist-packages/deluge/ui/console/utils/colors.py:122:check_tag_count
I rely heavily on deluge-console so I appreciate any help with this error.

Versions:

Code: Select all

deluge-console 2.0.3
libtorrent: 1.1.13.0
Python: 3.8.5
OS: Linux Ubuntu 20.04 focal
Thanks.

Re: BadColorString from deluge-console info

Posted: Fri Feb 26, 2021 5:56 pm
by jbrid
I removed the torrent that is died on, and it worked properly, with no error. The offending torrent had an exclamation point followed by a closing brace:

Code: Select all

!}
I suspect that's the characters combination that made if fail, because I have other torrents with exclamation points and braces in the name (non-consecutive) and those are displayed properly.

Re: BadColorString from deluge-console info

Posted: Fri Feb 26, 2021 6:07 pm
by mhertz
Good catch! I tried reproduce yesterday but couldn't and looked at the reported code, but couldn't make sence of much honestly, relating, as noob at coding. Glad to hear you workaround'ed it and thx for reporting workaround/solution back. Indeed the called strip_colors() function of deluge/ui/console/utils/colors.py returns a list of torrents with color-codes removed, and those color-codes start and end with '!{' and '!}' ;)