Opened 7 years ago

Closed 7 years ago

#1527 closed bug (Fixed)

Unhandled Exception in "move_storage" (trying to convert unicode to unicode)

Reported by: idefixx Owned by: Cas
Priority: minor Milestone: 1.3.2
Component: Core Version: 1.3.0_dev
Keywords: Cc:

Description

Deluge 1.3.1_dev (ea22bb0b10d52fa311c2a05f6a47d0893bd1bd78) libtorrent 0.15.5 (r5250) Debian Squeeze

This error occurs with or without AutoAdd? on my deluged, when I want to moved finished downloads on complete. The attached patch fixes the problem on my machine.

03:12:23 [deluge.core.preferencesmanager][WARNING ] Unable to find GeoIP database file!
03:14:27 [twisted                       ][ERROR   ] Unhandled Error
Traceback (most recent call last):
  File "/usr/local/lib/python2.6/dist-packages/deluge-1.3.1-py2.6-linux-i686.egg/deluge/main.py", line 247, in start_daemon
    Daemon(options, args)
  File "/usr/local/lib/python2.6/dist-packages/deluge-1.3.1-py2.6-linux-i686.egg/deluge/core/daemon.py", line 173, in __init__
    reactor.run()
  File "/usr/lib/python2.6/dist-packages/twisted/internet/base.py", line 1165, in run
    self.mainLoop()
  File "/usr/lib/python2.6/dist-packages/twisted/internet/base.py", line 1174, in mainLoop
    self.runUntilCurrent()
--- <exception caught here> ---
  File "/usr/lib/python2.6/dist-packages/twisted/internet/base.py", line 796, in runUntilCurrent
    call.func(*call.args, **call.kw)
  File "/usr/local/lib/python2.6/dist-packages/deluge-1.3.1-py2.6-linux-i686.egg/deluge/core/torrentmanager.py", line 855, in on_alert_torrent_finished
    torrent.move_storage(move_path)
  File "/usr/local/lib/python2.6/dist-packages/deluge-1.3.1-py2.6-linux-i686.egg/deluge/core/torrent.py", line 812, in move_storage
    dest_u=unicode(dest,"utf-8")
exceptions.TypeError: decoding Unicode is not supported
diff --git a/deluge/core/torrent.py b/deluge/core/torrent.py
index a1a2bdd..77f9f5c 100644
--- a/deluge/core/torrent.py
+++ b/deluge/core/torrent.py
@@ -808,9 +808,13 @@ def connect_peer(self, ip, port):
     def move_storage(self, dest):
         """Move a torrent's storage location"""

-        # Convert path from utf8 to unicode
-        dest_u=unicode(dest,"utf-8")
-
+        try:
+           # Convert path from utf8 to unicode
+           dest_u=unicode(dest,"utf-8")
+       except TypeError:
+           # String is already utf8
+           dest_u=dest
+
         if not os.path.exists(dest_u):
             try:
                 # Try to make the destination path if it doesn't exist

Change History (2)

comment:1 Changed 7 years ago by Cas

  • Milestone changed from Future to 1.3.2
  • Owner set to Cas
  • Status changed from new to accepted
  • Summary changed from Unhandled Exception in "move_storage" (trying to convert an utf8 string to utf8) to Unhandled Exception in "move_storage" (trying to convert unicode to unicode)
  • Type changed from defect to bug
  • Version changed from other (please specify) to 1.3.0_dev

comment:2 Changed 7 years ago by Cas

  • Resolution set to fixed
  • Status changed from accepted to closed

Fixed in 1.3-stable: 7d36a4fa51

Note: See TracTickets for help on using tickets.