Opened 5 years ago

Closed 5 years ago

Last modified 4 months ago

#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 by Calum, 5 years ago

Milestone: needs verified2.0.4
Priority: minorcritical

comment:2 by Calum, 5 years ago

Resolution: Fixed
Status: newclosed
Note: See TracTickets for help on using tickets.