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 2fb7b689a..6ee302132 100644 --- a/deluge/ui/gtkui/createtorrentdialog.py +++ b/deluge/ui/gtkui/createtorrentdialog.py @@ -369,7 +369,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):