From d4cfebadbcf24b085e2adbe844eee9398f87f0ad Mon Sep 17 00:00:00 2001 From: Damien Churchill Date: Mon, 27 Apr 2009 22:19:18 +0000 Subject: [PATCH] fix adding torrents on windows --- deluge/ui/gtkui/addtorrentdialog.py | 2 +- deluge/ui/web/json_api.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/deluge/ui/gtkui/addtorrentdialog.py b/deluge/ui/gtkui/addtorrentdialog.py index fdaa896b9..76cd7c695 100644 --- a/deluge/ui/gtkui/addtorrentdialog.py +++ b/deluge/ui/gtkui/addtorrentdialog.py @@ -683,7 +683,7 @@ class AddTorrentDialog(component.Component): for i, f in enumerate(torrent_filenames): client.core.add_torrent_file( os.path.split(f)[-1], - base64.encodestring(open(f).read()), + base64.encodestring(open(f, "rb").read()), torrent_options[i]) if torrent_magnets: client.core.add_torrent_magnets(torrent_magnets, torrent_magnet_options) diff --git a/deluge/ui/web/json_api.py b/deluge/ui/web/json_api.py index 6475e8773..73318894d 100644 --- a/deluge/ui/web/json_api.py +++ b/deluge/ui/web/json_api.py @@ -420,7 +420,7 @@ class WebApi(JSONComponent): """ for torrent in torrents: filename = os.path.basename(torrent["path"]) - fdump = base64.encodestring(open(torrent["path"], "r").read()) + fdump = base64.encodestring(open(torrent["path"], "rb").read()) log.info("Adding torrent from file `%s` with options `%r`", filename, torrent["options"]) client.core.add_torrent_file(filename, fdump, torrent["options"])