'str' object has no attribute 'decode'

General support for problems installing or using Deluge
Post Reply
avalloneandrea
New User
New User
Posts: 4
Joined: Fri Jan 26, 2024 6:36 pm

'str' object has no attribute 'decode'

Post by avalloneandrea »

I recently updated my distro from jessie to bullseye and reinstalled deluged and deluge-console.
I can't set the download location with deluge-console anymore.

This is the command I'm running

Code: Select all

deluge-console config --set download_location /media/hdd
This is the output

Code: Select all

 'str' object has no attribute 'decode'
19:38:58 [ERROR   ][deluge.ui.console.cmdline.command                     :138 ] 'str' object has no attribute 'decode'
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/deluge/ui/console/cmdline/command.py", line 135, in exec_command
    ret = self._commands[options.command].handle(options)
  File "/usr/lib/python3/dist-packages/deluge/ui/console/cmdline/commands/config.py", line 104, in handle
    return self._set_config(options)
  File "/usr/lib/python3/dist-packages/deluge/ui/console/cmdline/commands/config.py", line 143, in _set_config
    val = simple_eval(val)
  File "/usr/lib/python3/dist-packages/deluge/ui/console/cmdline/commands/config.py", line 72, in simple_eval
    res = atom(src, next(src))
  File "/usr/lib/python3/dist-packages/deluge/ui/console/cmdline/commands/config.py", line 57, in atom
    return token[-1].decode('string-escape')
AttributeError: 'str' object has no attribute 'decode'
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/deluge/ui/console/cmdline/command.py", line 135, in exec_command
    ret = self._commands[options.command].handle(options)
  File "/usr/lib/python3/dist-packages/deluge/ui/console/cmdline/commands/config.py", line 104, in handle
    return self._set_config(options)
  File "/usr/lib/python3/dist-packages/deluge/ui/console/cmdline/commands/config.py", line 143, in _set_config
    val = simple_eval(val)
  File "/usr/lib/python3/dist-packages/deluge/ui/console/cmdline/commands/config.py", line 72, in simple_eval
    res = atom(src, next(src))
  File "/usr/lib/python3/dist-packages/deluge/ui/console/cmdline/commands/config.py", line 57, in atom
    return token[-1].decode('string-escape')
AttributeError: 'str' object has no attribute 'decode'
This is my configuration:

deluged 2.0.3
deluge-console 2.0.3
libtorrent: 1.2.9.0
Python: 3.9.2
OS: Linux Raspbian GNU/Linux 11 bullseye
mhertz
Moderator
Moderator
Posts: 2216
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: 'str' object has no attribute 'decode'

Post by mhertz »

Fixed in later release, if wanted can apply it to deluge 2.0.3 with:

Code: Select all

sudo find /usr -path "*/deluge/ui/console/cmdline/commands/config.py" -exec sh -c 'curl https://github.com/deluge-torrent/deluge/commit/2f1c008a26b50ab3487bd03bcabb39347d441f23.patch | patch {}' \;
(A couple chunks will state failed, but just disregard because related to missing test files not included in packaged deluge releases, and so the 4 succeded chunks are the relevant ones here anyway - I was to lazy to cut there headers out in added extra pipe, or remake patch, when not important for end-result anyways)
avalloneandrea
New User
New User
Posts: 4
Joined: Fri Jan 26, 2024 6:36 pm

Re: 'str' object has no attribute 'decode'

Post by avalloneandrea »

It worked, thank you!
Last edited by avalloneandrea on Mon Jan 29, 2024 4:08 pm, edited 1 time in total.
mhertz
Moderator
Moderator
Posts: 2216
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: 'str' object has no attribute 'decode'

Post by mhertz »

Much welcome buddy, and sorry missed your post initially :)
Post Reply