#3298 closed bug (Fixed)

importing state of torrents from older deluge to newer deluge fails

Reported by: human Owned by:
Priority: critical Milestone: 2.0.4
Component: Core Version: 2.0.3
Keywords: Cc:

Description

On migrating from the earlier 1.3.15* to 2.0.3 a problem crops up which is probably caused by non-English letters in torrent names

log output exert

19:53:11 [INFO    ][deluge.core.torrentmanager        :806 ] Loading torrent state: /home/userWhateverthehell/.config/deluge/state/torrents.state
19:53:11 [ERROR   ][deluge.component                  :132 ] [Failure instance: Traceback: <class 'UnicodeDecodeError'>: 'ascii' codec can't decode byte 0xe5 in position 12: ordinal not in range(128)
/usr/lib/python3.7/site-packages/twisted/internet/_glibbase.py:333:_simulate
/usr/lib/python3.7/site-packages/twisted/internet/base.py:902:runUntilCurrent
/usr/lib/python3.7/site-packages/twisted/internet/defer.py:460:callback
/usr/lib/python3.7/site-packages/twisted/internet/defer.py:568:_startRunCallbacks
--- <exception caught here> ---
/usr/lib/python3.7/site-packages/twisted/internet/defer.py:654:_runCallbacks
/usr/lib/python3.7/site-packages/twisted/internet/task.py:865:<lambda>
/usr/lib/python3.7/site-packages/deluge/core/torrentmanager.py:239:start
/usr/lib/python3.7/site-packages/deluge/core/torrentmanager.py:832:load_state
/usr/lib/python3.7/site-packages/deluge/core/torrentmanager.py:812:open_state
]
19:53:11 [CRITICAL][twisted                           :154 ] Unhandled error in Deferred:
19:53:11 [CRITICAL][twisted                           :154 ] Unhandled error in Deferred:
19:53:11 [CRITICAL][deluge.log                        :93  ] twisted.internet.defer 
[Failure instance: Traceback: <class 'UnicodeDecodeError'>: 'ascii' codec can't decode byte 0xe5 in position 12: ordinal not in range(128)
/usr/lib/python3.7/site-packages/twisted/internet/_glibbase.py:333:_simulate
/usr/lib/python3.7/site-packages/twisted/internet/base.py:902:runUntilCurrent
/usr/lib/python3.7/site-packages/twisted/internet/defer.py:460:callback
/usr/lib/python3.7/site-packages/twisted/internet/defer.py:568:_startRunCallbacks
--- <exception caught here> ---
/usr/lib/python3.7/site-packages/twisted/internet/defer.py:654:_runCallbacks
/usr/lib/python3.7/site-packages/twisted/internet/task.py:865:<lambda>
/usr/lib/python3.7/site-packages/deluge/core/torrentmanager.py:239:start
/usr/lib/python3.7/site-packages/deluge/core/torrentmanager.py:832:load_state
/usr/lib/python3.7/site-packages/deluge/core/torrentmanager.py:812:open_state
]

seems to be caused by pickle.load having encoding="ASCII" as default

https://docs.python.org/3/library/pickle.html#pickle.load


/usr/lib/python3.7/site-packages/deluge/core/torrentmanager.py:812

                    state = pickle.load(_file)

should be changed something like the below (although the encoding probably need to be something else to cover all cases)

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

then importing to 2.0.3 works just fine

Change History (2)

comment:1 Changed 11 months ago by Cas

  • Milestone changed from needs verified to 2.0.4
  • Priority changed from minor to critical

comment:2 Changed 11 months ago by Cas

  • Resolution set to Fixed
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.