Opened 5 years ago

Last modified 4 years ago

#3285 new bug

UnicodeDecodeError in torrents.state

Reported by: raduetsya Owned by:
Priority: minor Milestone: needs verified
Component: Unknown Version: 2.0.3
Keywords: Cc:


All my torrents have disappeared since the last update.

$ deluge -L debug

12:36:05 [INFO    ][deluge.core.torrentmanager        :806 ] Loading torrent state: /home/raduetsya/.config/deluge/state/torrents.state
12:36:05 [ERROR   ][deluge.component                  :132 ] [Failure instance: Traceback: <class 'UnicodeDecodeError'>: 'ascii' codec can't decode byte 0xd0 in pos

After the workaround below, all the torrents are back.

---	2019-07-07 14:40:56.551872384 +0700
+++	2019-07-07 14:26:52.176421350 +0700
@@ -809,7 +809,7 @@
                 with open(filepath, 'rb') as _file:
-                    state = pickle.load(_file)
+                    state = pickle.load(_file, encoding='latin1')
             except (IOError, EOFError, pickle.UnpicklingError) as ex:
                 message = 'Unable to load {}: {}'.format(filepath, ex)

Client: 2.0.3 libtorrent:

Change History (6)

comment:1 Changed 5 years ago by youngian

I had the same issue as the OP. Same client versions, Arch Linux, Python 3.7.3. Can confirm that the included patch resolves the issue.

comment:2 Changed 5 years ago by youngian

  • Cc added

comment:3 Changed 5 years ago by Olivier

In my case, it needed to be

state = pickle.load(_file, encoding='utf-8')

comment:4 Changed 5 years ago by yangsheng6810

I can confirm the patch by @Olivier. Arch Linux, python 3.7.3, deluge 2.0.3-1.

comment:5 Changed 4 years ago by Phidica

I also confirm the patch by @Olivier, preferring the 'utf-8' encoding. Upgrading from Fedora 30 deluge-1.3.15-12 to Fedora 31 deluge-2.0.3-5.

comment:6 Changed 4 years ago by jools772

Why is python 3.7 using ascii encoding?

Note: See TracTickets for help on using tickets.