From 16891b7f47ed728b4aeae3c1ecab1f94e8dad769 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 6 Apr 2014 13:40:37 +0530 Subject: [PATCH] Fix #1303181 [ebook-device cp -f gives exits with error when trying to copy to kindle](https://bugs.launchpad.net/calibre/+bug/1303181) --- src/calibre/devices/cli.py | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/calibre/devices/cli.py b/src/calibre/devices/cli.py index 13d50f2772..af2ad937fd 100755 --- a/src/calibre/devices/cli.py +++ b/src/calibre/devices/cli.py @@ -10,7 +10,6 @@ import StringIO, sys, time, os from optparse import OptionParser from calibre import __version__, __appname__, human_readable, fsync -from calibre.devices.errors import PathError from calibre.devices.errors import ArgumentError, DeviceError, DeviceLocked from calibre.customize.ui import device_plugins from calibre.devices.scanner import DeviceScanner @@ -319,14 +318,7 @@ def main(): print >> sys.stderr, e parser.print_help() return 1 - try: - dev.put_file(infile, args[1][4:]) - except PathError as err: - if options.force and 'exists' in str(err): - dev.del_file(err.path, False) - dev.put_file(infile, args[1][4:]) - else: - raise + dev.put_file(infile, args[1][4:], replace_file=options.force) infile.close() else: parser.print_help()