From 3bd28208d17567b9fe81a715767c3545f2332587 Mon Sep 17 00:00:00 2001 From: Calum Lind Date: Fri, 4 Feb 2011 23:16:42 +0000 Subject: [PATCH] Fix for deluge-console adding torrent files in Windows --- deluge/ui/console/commands/add.py | 2 +- deluge/ui/gtkui/createtorrentdialog.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/deluge/ui/console/commands/add.py b/deluge/ui/console/commands/add.py index 8d688187c..7878438d9 100644 --- a/deluge/ui/console/commands/add.py +++ b/deluge/ui/console/commands/add.py @@ -71,7 +71,7 @@ class Command(BaseCommand): continue self.console.write("{!info!}Attempting to add torrent: %s" % arg) filename = os.path.split(arg)[-1] - filedump = base64.encodestring(open(arg).read()) + filedump = base64.encodestring(open(arg, "rb").read()) def on_success(result): self.console.write("{!success!}Torrent added!") diff --git a/deluge/ui/gtkui/createtorrentdialog.py b/deluge/ui/gtkui/createtorrentdialog.py index 5624a634f..c455eb07a 100644 --- a/deluge/ui/gtkui/createtorrentdialog.py +++ b/deluge/ui/gtkui/createtorrentdialog.py @@ -367,7 +367,7 @@ class CreateTorrentDialog: if add_to_session: client.core.add_torrent_file( os.path.split(target)[-1], - base64.encodestring(open(target).read()), + base64.encodestring(open(target, "rb").read()), {"download_location": os.path.split(path)[0]}) def _on_create_torrent_progress(self, value, num_pieces):